Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program to help a local rental company identify which of its vehicles are suitable for hauling a specified load. Inputs to the
Write a program to help a local rental company identify which of its vehicles are suitable for hauling a specified load. Inputs to the program are: the name of the file containing vehicle data, the estimated weight of the load in pounds, and the estimated volume of the load in cubic feet. The program should correctly read the data file using a Scanner and print information on vehicles that can accommodate the load. A vehicle can accommodate a given load only if both the estimated weight and volume of the load do not exceed the maximum cargo weight and volume specifications of the vehicle. The data items are arranged as follows for each vehicle stored in the file: vehicle code daily rate maximum cargo weight maximum cargo volume vehicle type Below are the sample data file contents. Copy and save this to a file named fleet.txt. V001 90.0 4000 250 Ford Van V002 99.0 2900 400 GM Small Truck V003 99.0 2900 400 GM Small Truck V004 127.5 6160 860 Ford Medium Truck V005 145.0 12900 1650 GM Large Truck Use ONLY topics covered in Modules 1 - 6 to solve question. You are NOT allowed to use ArrayLists. You may use arrays but they are not required to solve this problem. Here are 3 separate sample runs, user input is shown in bold underline: Sample Run #1 Enter fleet data filename: c:/temp/fleet.txt Estimated weight of cargo (pounds): 800 Estimated volume of cargo (cubic ft): 251 The following vehicles will accommodate this cargo load: V002 GM Small Truck at $99.00 per day V003 GM Small Truck at $99.00 per day V004 Ford Medium Truck at $127.50 per day V005 GM Large Truck at $145.00 per day Sample Run #1 Enter fleet data filename: c:/temp/fleet.txt Estimated weight of cargo (pounds): 800 Estimated volume of cargo (cubic ft): 251 The following vehicles will accommodate this cargo load: V002 GM Small Truck at $99.00 per day V003 GM Small Truck at $99.00 per day. V004 Ford Medium Truck at $127.50 per day. V005 GM Large Truck at $145.00 per day Sample Run #2 Enter fleet data filename: c:/temp/fleet.txt Estimated weight of cargo (pounds): 13000 Estimated volume of cargo (cubic ft): 1600 The following vehicles will accommodate this cargo load: Sample Run #3 Enter fleet data filename: c:/temp/fleet.txt Estimated weight of cargo (pounds): 3500 Estimated volume of cargo (cubic ft): 500 The following vehicles will accommodate this cargo load: V004 Ford Medium Truck at $127.50 per day V005 GM Large Truck at $145.00 per day.
Step by Step Solution
★★★★★
3.34 Rating (148 Votes )
There are 3 Steps involved in it
Step: 1
The Java program that takes the input file name estimated weight and estimated volume of the cargo a...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started