Hello!! So I understand this problem Im just having problems creating a driver class and how I actually compare the two arrays and printing my soulion ive created all my classes just need an extra guiding hand or exame
2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE 79% @ D. Specifications 1. Create a Java class called LastNameFirstNameAssignment4 2. Follow "CS1450 Programming Assignments Policy . Write a test program (i.e. main) to do the following: Step 1: Create a vending machine object o Contains a tower of cars (2D array) with the number of slots & columns read from file. Step 2: Load vending machine with all cars in the file o For each car in the file: o Read details for the car from the file. o Create a car object using the details. o Add car to vending machine's tower in slot and column specified in file o Use the addCarTo Tower method in the VendingMachine class Step 4: Display the loaded vending machine. o Display a nicely formatted version of the vending machine o Use the displayCars0 method in the VendingMachine class Step 3: Print an inventory report for the vending machine. Write a method to print report: public static void printInventory (VendingMachine vendingMachine) This method must: Be placed in your Assignment4 class Create one VehicleReport for each car and place all reports into an ArrayList the Collections.sortO method are now sorted by price) Sort all VehicleReports in the ArrayList using Print all VehicleReports in the ArrayList (which o Call the print0 method on VehicleReport (see 2" output example) 4. Test file information a. Run your code on the provided file VendingMachineCars.txt This file is an example so DO NOT assume that your code should only work for a car tower with 6 slots and 5 columns and/or these cars in this specific order. The grader file will be different. 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE 79% @ D. Specifications 1. Create a Java class called LastNameFirstNameAssignment4 2. Follow "CS1450 Programming Assignments Policy . Write a test program (i.e. main) to do the following: Step 1: Create a vending machine object o Contains a tower of cars (2D array) with the number of slots & columns read from file. Step 2: Load vending machine with all cars in the file o For each car in the file: o Read details for the car from the file. o Create a car object using the details. o Add car to vending machine's tower in slot and column specified in file o Use the addCarTo Tower method in the VendingMachine class Step 4: Display the loaded vending machine. o Display a nicely formatted version of the vending machine o Use the displayCars0 method in the VendingMachine class Step 3: Print an inventory report for the vending machine. Write a method to print report: public static void printInventory (VendingMachine vendingMachine) This method must: Be placed in your Assignment4 class Create one VehicleReport for each car and place all reports into an ArrayList the Collections.sortO method are now sorted by price) Sort all VehicleReports in the ArrayList using Print all VehicleReports in the ArrayList (which o Call the print0 method on VehicleReport (see 2" output example) 4. Test file information a. Run your code on the provided file VendingMachineCars.txt This file is an example so DO NOT assume that your code should only work for a car tower with 6 slots and 5 columns and/or these cars in this specific order. The grader file will be different. AT&T LTE 2:30 PM 79% @O a inst-fs-iad-prod.inscloudgate.net Number of slots in the tower (array row index) Number of columns in tower (array column index) 1 1 29400.00 2015 Toyota Tacoma 12 31700,00 2012 BMW 6Series 15 41700.00 2016 Ford Mustang Details for each car 2 1 31000.00 2017 BMW XI 2 3 14300.00 2015 Nissan Altima 2 5 17900.00 2016 Dodge Challenger 32 26000.00 2017 Mini Convertible 3 3 39600.00 2017 Chevrolet Tahoe 41 15100.00 2014 Chevy Volt Note: Column 0 and Slot 0 are NOT used Column 1: slots 3 & 4 are empty Column 2: slots 2 & 4 are empty Column 3: slots 1,4 &5 are empty 4 2 24400.00 2017 Toyota Rav4 43 30400.00 2017 Subaru Outback 44 72900.00 2017 Tesla Model-S 5 43500.00 2016 Porsche Cayenne Column 4: no empty slots b. 1 line is the number of slots that each column contains c. 2 line is the number of columns in the vending machine's tower d. Remaining lines contain details for each car. The format is as follows: Column#Slot# Price Year Manufacturer Model 1129400.00 2015 Toyota Tacoma Interfaces and Classes Printable Interface Description o This interface represents an object's ability to print details about itself Public Methods o printO - returns string with details object wants to display in a nice format VendingMachine Class 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE VendingMachine Class o Represents the vending machine of cars. o The vending machine contains one car tower that is modeled by a If you "flatten" the car tower it can be viewed as a 2D array of car objects. I'm using the word "slot" instead of row" since slot makes more sense when talking about placing a car in the tower, so slot-row in this assignment Slot 0 and column 0 are not used They are still part of 2D array, but we won't be placing cars into them 5 columns (0-4) slots 1-5 and columns 1-4 in the array as In the test file, the tower has 6 slots (0-5) and BUT the car tower is represented ONLY by shown: Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Toyota BMWChevy BMWMini Toyota Nissan Chevy Subaru Tesla Ford DodgePorsche Private Data Fields numberSlots number of slots in each column (i.e. row index) o o numberColumns number of columns in the vending machine (i.e. column index) o carTower-array of Car objects use a 2D array NOT ArrayList see FAQ for help with 2D arrays Public Methods o Constructor public VendingMachine (int numberSlots, int numberColumns,) Initializes numberSlots and numberColumns to incoming values Initializes size of car tower (2D array) to numberSlots and numberColumns 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE 79% Public Methods o Constructor: public VendingMachine (int numberSlots, int numberColumns) Initializes numberSlots and numberColumns to incoming values Initializes size of car tower (2D array) to numberSlots and numberColumns carTower- new Car[numberSlots] [numberColumns]: o Getters: For data fields numberSlots and numberColumns o Setters: None o addCarTo Tower (int slotNumber, int columnNumber, Car car) Places incoming car object in 2D array at a specified location (slot/column) in a specific location Returns the car stored in the tower (2D array) at Simulates loading a car into the vending machine o getCar (int slot, int column) the specific slot/column . If there is no car in slot/column location (i.e. empty array location), returns null o displayCars Displays a nicely formatted version of the vending machine's tower (2D array) Print slot #. column #, and car manufacturer (see I"example output below) Car Class Description o Represents one car Private Data Fields o price- double value for the car's sticker price o year-integer value for the car's year o manufacturer- string value for the car's manufacturer o model-string value for the car's model Public Methods o Constructor public Car (double price, int year, String manufacturer, String model) 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE Car Class Description o Represents one car Private Data Fields o price double value for the car's sticker price o year integer value for the car's year o manufacturer-string value for the car's manufacturer o model -string value for the car's model Public Methods o Constructor public Car (double price, int year, String manufacturer, String model) initializes all private data fields with incoming values o Getter: One for each data field o Setters: None VehicleReport Class Description o Represents the report for one vehicle. o Contains slot number, column number, year, manufacturer, model, and price. o Class must implement Printable and ComparableVehicleReport> Private Data Fields o slotN umber-slot # vehicle is stored in (i.e. array row index) o columnN umber-column # vehicle is stored in (ie. array column index) o price double value for vehicle's sticker price o year-integer value for the vehicle's year o manufacturer string value for the vehicle's manufacturer o model -string value for the vehicle's model . Public Methods o Constructor public VehicleRecord (int slotNumber int column Number, double price, int year, String manufacturer, String model) initializes all private data fields with i o Getters and Setter: None 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE Output Your output will look like the following when running against the test file VendingMachineCars.txt Loa ding cars into vending machine.. Column Column 2 Column 3 Column 4 Slot 1 Slot 2 Slot 3 Toyota BMW Chevy Mini Nissan Tesla Porsche BMW Toyota Chevy Subaru Slot 4 Slot 5 Ford Dodge Dashes represent an empty slot in tower Produced using method on Re print Vehicle VENDING MACHING INVENTORY (From Low to High Price) Column S Ye Manufacturer Model Price 2 3 2015 Nissan Altima 14300.00 42014Chevy 2014 Volt 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE print method on Vehicle Report 4 VENDING MACHING INVENTORY (From Low to High Price) Column Slot Year Manufacturer Model Price Altima 2 3 2015 Nissan 4 2014 Chevy 2014 Volt 2 5 2016 Dodge 4 2 2017 Toyota 3 2 2017 Mini 1 2015 Toyota 4 3 2017 Subaru 22017 BMW 1 22012 BMWW 3 3 2017 Chevy Tahoe 1 5 2016 Ford 4 5 2016 Prsche 4 4 2017 Tesla 14300.00 15100.00 17900.00 24400.00 26000.00 29400.00 30400.00 31000.00 31700.00 39600.00 41700.00 43500.00 72900.00 Challenger Rav4 Convertible Tacoma Outback 6Series Mustang Cayenne Model-S AT&T LTE 2:31 PM a inst-fs-iad-prod.inscloudgate.net 1 1 29400.00 2015 Toyota Tacoma 1 2 31700.00 2012 BMW 6Series 1 5 41700.00 2016 Ford Mustang 2 1 31000.00 2017 BMW X1 2 3 14300.00 2015 Nissan Altima 2 5 17900.00 2016 Dodge Challenger 3 2 26000.00 2017 Mini Convertible 3 3 39600.00 2017 Chevy Tahoe 41 15100.00 2014 Chevy Volt 4 2 24400.00 2017 Toyota Rav4 4 3 30400.00 2017 Subaru Outback 4 4 72900.00 2017Tesla Model-s 4 5 43500.00 2016 Porsche Cayenne 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE 79% @ D. Specifications 1. Create a Java class called LastNameFirstNameAssignment4 2. Follow "CS1450 Programming Assignments Policy . Write a test program (i.e. main) to do the following: Step 1: Create a vending machine object o Contains a tower of cars (2D array) with the number of slots & columns read from file. Step 2: Load vending machine with all cars in the file o For each car in the file: o Read details for the car from the file. o Create a car object using the details. o Add car to vending machine's tower in slot and column specified in file o Use the addCarTo Tower method in the VendingMachine class Step 4: Display the loaded vending machine. o Display a nicely formatted version of the vending machine o Use the displayCars0 method in the VendingMachine class Step 3: Print an inventory report for the vending machine. Write a method to print report: public static void printInventory (VendingMachine vendingMachine) This method must: Be placed in your Assignment4 class Create one VehicleReport for each car and place all reports into an ArrayList the Collections.sortO method are now sorted by price) Sort all VehicleReports in the ArrayList using Print all VehicleReports in the ArrayList (which o Call the print0 method on VehicleReport (see 2" output example) 4. Test file information a. Run your code on the provided file VendingMachineCars.txt This file is an example so DO NOT assume that your code should only work for a car tower with 6 slots and 5 columns and/or these cars in this specific order. The grader file will be different. 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE 79% @ D. Specifications 1. Create a Java class called LastNameFirstNameAssignment4 2. Follow "CS1450 Programming Assignments Policy . Write a test program (i.e. main) to do the following: Step 1: Create a vending machine object o Contains a tower of cars (2D array) with the number of slots & columns read from file. Step 2: Load vending machine with all cars in the file o For each car in the file: o Read details for the car from the file. o Create a car object using the details. o Add car to vending machine's tower in slot and column specified in file o Use the addCarTo Tower method in the VendingMachine class Step 4: Display the loaded vending machine. o Display a nicely formatted version of the vending machine o Use the displayCars0 method in the VendingMachine class Step 3: Print an inventory report for the vending machine. Write a method to print report: public static void printInventory (VendingMachine vendingMachine) This method must: Be placed in your Assignment4 class Create one VehicleReport for each car and place all reports into an ArrayList the Collections.sortO method are now sorted by price) Sort all VehicleReports in the ArrayList using Print all VehicleReports in the ArrayList (which o Call the print0 method on VehicleReport (see 2" output example) 4. Test file information a. Run your code on the provided file VendingMachineCars.txt This file is an example so DO NOT assume that your code should only work for a car tower with 6 slots and 5 columns and/or these cars in this specific order. The grader file will be different. AT&T LTE 2:30 PM 79% @O a inst-fs-iad-prod.inscloudgate.net Number of slots in the tower (array row index) Number of columns in tower (array column index) 1 1 29400.00 2015 Toyota Tacoma 12 31700,00 2012 BMW 6Series 15 41700.00 2016 Ford Mustang Details for each car 2 1 31000.00 2017 BMW XI 2 3 14300.00 2015 Nissan Altima 2 5 17900.00 2016 Dodge Challenger 32 26000.00 2017 Mini Convertible 3 3 39600.00 2017 Chevrolet Tahoe 41 15100.00 2014 Chevy Volt Note: Column 0 and Slot 0 are NOT used Column 1: slots 3 & 4 are empty Column 2: slots 2 & 4 are empty Column 3: slots 1,4 &5 are empty 4 2 24400.00 2017 Toyota Rav4 43 30400.00 2017 Subaru Outback 44 72900.00 2017 Tesla Model-S 5 43500.00 2016 Porsche Cayenne Column 4: no empty slots b. 1 line is the number of slots that each column contains c. 2 line is the number of columns in the vending machine's tower d. Remaining lines contain details for each car. The format is as follows: Column#Slot# Price Year Manufacturer Model 1129400.00 2015 Toyota Tacoma Interfaces and Classes Printable Interface Description o This interface represents an object's ability to print details about itself Public Methods o printO - returns string with details object wants to display in a nice format VendingMachine Class 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE VendingMachine Class o Represents the vending machine of cars. o The vending machine contains one car tower that is modeled by a If you "flatten" the car tower it can be viewed as a 2D array of car objects. I'm using the word "slot" instead of row" since slot makes more sense when talking about placing a car in the tower, so slot-row in this assignment Slot 0 and column 0 are not used They are still part of 2D array, but we won't be placing cars into them 5 columns (0-4) slots 1-5 and columns 1-4 in the array as In the test file, the tower has 6 slots (0-5) and BUT the car tower is represented ONLY by shown: Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Toyota BMWChevy BMWMini Toyota Nissan Chevy Subaru Tesla Ford DodgePorsche Private Data Fields numberSlots number of slots in each column (i.e. row index) o o numberColumns number of columns in the vending machine (i.e. column index) o carTower-array of Car objects use a 2D array NOT ArrayList see FAQ for help with 2D arrays Public Methods o Constructor public VendingMachine (int numberSlots, int numberColumns,) Initializes numberSlots and numberColumns to incoming values Initializes size of car tower (2D array) to numberSlots and numberColumns 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE 79% Public Methods o Constructor: public VendingMachine (int numberSlots, int numberColumns) Initializes numberSlots and numberColumns to incoming values Initializes size of car tower (2D array) to numberSlots and numberColumns carTower- new Car[numberSlots] [numberColumns]: o Getters: For data fields numberSlots and numberColumns o Setters: None o addCarTo Tower (int slotNumber, int columnNumber, Car car) Places incoming car object in 2D array at a specified location (slot/column) in a specific location Returns the car stored in the tower (2D array) at Simulates loading a car into the vending machine o getCar (int slot, int column) the specific slot/column . If there is no car in slot/column location (i.e. empty array location), returns null o displayCars Displays a nicely formatted version of the vending machine's tower (2D array) Print slot #. column #, and car manufacturer (see I"example output below) Car Class Description o Represents one car Private Data Fields o price- double value for the car's sticker price o year-integer value for the car's year o manufacturer- string value for the car's manufacturer o model-string value for the car's model Public Methods o Constructor public Car (double price, int year, String manufacturer, String model) 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE Car Class Description o Represents one car Private Data Fields o price double value for the car's sticker price o year integer value for the car's year o manufacturer-string value for the car's manufacturer o model -string value for the car's model Public Methods o Constructor public Car (double price, int year, String manufacturer, String model) initializes all private data fields with incoming values o Getter: One for each data field o Setters: None VehicleReport Class Description o Represents the report for one vehicle. o Contains slot number, column number, year, manufacturer, model, and price. o Class must implement Printable and ComparableVehicleReport> Private Data Fields o slotN umber-slot # vehicle is stored in (i.e. array row index) o columnN umber-column # vehicle is stored in (ie. array column index) o price double value for vehicle's sticker price o year-integer value for the vehicle's year o manufacturer string value for the vehicle's manufacturer o model -string value for the vehicle's model . Public Methods o Constructor public VehicleRecord (int slotNumber int column Number, double price, int year, String manufacturer, String model) initializes all private data fields with i o Getters and Setter: None 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE Output Your output will look like the following when running against the test file VendingMachineCars.txt Loa ding cars into vending machine.. Column Column 2 Column 3 Column 4 Slot 1 Slot 2 Slot 3 Toyota BMW Chevy Mini Nissan Tesla Porsche BMW Toyota Chevy Subaru Slot 4 Slot 5 Ford Dodge Dashes represent an empty slot in tower Produced using method on Re print Vehicle VENDING MACHING INVENTORY (From Low to High Price) Column S Ye Manufacturer Model Price 2 3 2015 Nissan Altima 14300.00 42014Chevy 2014 Volt 2:30 PM a inst-fs-iad-prod.inscloudgate.net AT&T LTE print method on Vehicle Report 4 VENDING MACHING INVENTORY (From Low to High Price) Column Slot Year Manufacturer Model Price Altima 2 3 2015 Nissan 4 2014 Chevy 2014 Volt 2 5 2016 Dodge 4 2 2017 Toyota 3 2 2017 Mini 1 2015 Toyota 4 3 2017 Subaru 22017 BMW 1 22012 BMWW 3 3 2017 Chevy Tahoe 1 5 2016 Ford 4 5 2016 Prsche 4 4 2017 Tesla 14300.00 15100.00 17900.00 24400.00 26000.00 29400.00 30400.00 31000.00 31700.00 39600.00 41700.00 43500.00 72900.00 Challenger Rav4 Convertible Tacoma Outback 6Series Mustang Cayenne Model-S AT&T LTE 2:31 PM a inst-fs-iad-prod.inscloudgate.net 1 1 29400.00 2015 Toyota Tacoma 1 2 31700.00 2012 BMW 6Series 1 5 41700.00 2016 Ford Mustang 2 1 31000.00 2017 BMW X1 2 3 14300.00 2015 Nissan Altima 2 5 17900.00 2016 Dodge Challenger 3 2 26000.00 2017 Mini Convertible 3 3 39600.00 2017 Chevy Tahoe 41 15100.00 2014 Chevy Volt 4 2 24400.00 2017 Toyota Rav4 4 3 30400.00 2017 Subaru Outback 4 4 72900.00 2017Tesla Model-s 4 5 43500.00 2016 Porsche Cayenne