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 : 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
Convert a length
Add a type of conversion
Delete a type of conversion
Exit
Enter menu number:
Miles to Kilometers:
Kilometers to Miles:
Inches to Centimeters:
Enter conversion number:
Enter Kilometers:
Kilometers Miles
Convert a length
Add a type of conversion
Delete a type of conversion
Exit
Enter menu number:
Enter 'From' unit: Centimeters
Enter To unit: Inches
Enter the conversion ratio:
This entry has been saved.
Convert a length
Add a type of conversion
Delete a type of conversion
Exit
Enter menu number:
Miles to Kilometers:
Kilometers to Miles:
Inches to Centimeters:
Centimeters to Inches:
Enter conversion number:
Enter Centimeters:
Centimeters Inches
Convert a length
Add a type of conversion
Delete a type of conversion
Exit
Enter menu number:
Goodbye.
Project : 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 saveConversionsArrayList typesList
Store the list of conversions in a text file named conversiontypes.txt thats in the same directory as the class that reads and writes the file. If the conversiontypes.txt file doesnt exist, the class should create it This class should use buffered IO streams, and it should close all IO 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, nonempty 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
