Question: Your task is to complete the main method in the FruitCosts class. The program should do the following: Read the input file specified in the

Your task is to complete the main method in the FruitCosts class. The program should do the following:
Read the input file specified in the command-line argument.
Read the number of fruits from the input file.
Create two parallel arrays: one for fruit names and one for their costs.
Read the fruit names and costs from the input file and store them in the respective arrays.
Find the two fruits with the lowest costs.
Print the names and costs of the two lowest-cost fruits.
Calculate and print the total cost of these two fruits.
Expected output format: [Lowest cost fruit name][Lowest cost][Second lowest cost fruit name][Second lowest cost] Total [Sum of the two lowest costs] Note: In the case that multiple fruits have the same cost, maintain the order in which they appear in the input file.
Your task is to complete the main method in the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!