/* MakeInv1R.java CIS 111 David Klick October 20, 2007 This program creates an inventory data file for use with an inventory report program to be created in class. This program uses random file access. */ public class MakeInv1R extends CIS111App { public static void main(String[] args) { Record rec = new Record(); println("Creating inventory file (invdataR.dta)"); RandomFile outfile = new RandomFile("invdataR.dta", rec); outfile.put(1, new Record("C101", 1, "Roadhandler", 97.56, 125.11, 25)); outfile.put(2, new Record("C204", 3, "Whitewalls", 37.14, 99.95, 140)); outfile.put(3, new Record("C502", 2, "Tripod", 32.5, 38.99, 10)); outfile.put(4, new Record("S209", 1, "MaxiDrill", 88.76, 109.99, 6)); outfile.put(5, new Record("S416", 2, "NormalSaw", 152.55, 179.4, 1)); outfile.put(6, new Record("S812", 2, "Router", 48.47, 61.15, 8)); outfile.put(7, new Record("S942", 4, "RadialSaw", 376.04, 419.89, 3)); outfile.put(8, new Record("T615", 4, "Oxford-Style", 26.43, 31.5, 28)); outfile.put(9, new Record("T713", 2, "Moc-Boot", 24.99, 29.99, 30)); outfile.put(10, new Record("T814", 2, "Work-Boot", 22.99, 27.99, 56)); outfile.close(); println("File created"); } } class Record { String SKU = "xxxx"; int location = 0; String description = "xxxxxxxxxxxxxxxxxxxx"; double cost = 0.0; double price = 0.0; long quantity = 0; public Record() {} public Record(String sku, int loc, String desc, double cost, double price, long qty) { SKU = sku; location = loc; description = desc; this.cost = cost; this.price = price; quantity = qty; } }