Question: Project 9 - 2 : Length Converter Create a Java application that allows the user to convert a length from a list of conversions that

Project 9-2: Length Converter
Create a Java application that allows the user to convert a length from a list of conversions that are stored in a file. This application should also allow the user to add or delete conversions from the list of conversions.
Console
Length Converter
1- Convert a length
2- Add a type of conversion
3- Delete a type of conversion
4- Exit
Enter menu number: 1
1- Miles to Kilometers: 1.6093
2- Kilometers to Miles: 0.6214
3- Inches to Centimeters: 2.54
Enter conversion number: 2
Enter Kilometers: 10
10.0 Kilometers =6.214 Miles
1- Convert a length
2- Add a type of conversion
3- Delete a type of conversion
4- Exit
Enter menu number: 2
Enter 'From' unit: Centimeters
Enter 'To' unit: Inches
Enter the conversion ratio: .3937
This entry has been saved.
1- Convert a length
2- Add a type of conversion
3- Delete a type of conversion
4- Exit
Enter menu number: 1
1- Miles to Kilometers: 1.6093
2- Kilometers to Miles: 0.6214
3- Inches to Centimeters: 2.54
4- Centimeters to Inches: 0.3937
Enter conversion number: 4
Enter Centimeters: 2.54
2.54 Centimeters =1 Inches
1- Convert a length
2- Add a type of conversion
3- Delete a type of conversion
4- Exit
Enter menu number: 4
Goodbye.
Project 9-2: Length Converter (continued)
Specifications
Create a class named Conversion that can store information about a conversion, including fromUnit, fromValue, toUnit, toValue, and conversionRatio. This class should also contain the methods that perform the conversion calculations and return the results as a formatted string.
Create a class that contains the methods that store an array list of Conversion objects in a file. For example:
public ArrayList getConversions()
public boolean saveConversions(ArrayList typesList)
Store the list of conversions in a text file named conversion_types.txt thats in the same directory as the class that reads and writes the file. If the conversion_types.txt file doesnt exist, the class should create it. This class should use buffered I/O streams, and it should close all I/O streams when theyre no longer needed.
Use the Console class or a variation of it to validate the users entries. A valid integer is required for a menu choice, non-empty strings are required for the From and To fields, and a valid double is required for the conversion ratio.

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!