Question
Write a Java program to convert from US units to metric units. Your user will have 3 options in a main menu Length Volume Temperature
Write a Java program to convert from US units to metric units.
Your user will have 3 options in a main menu
Length
Volume
Temperature
The length option will offer the user the option of converting from inches to centimeters or from centimeters to inches.
The volume option will offer the user the option of converting from gallons to liters or from liters to gallons
The temperature option will offer the user the option of converting from Fahrenheit to Celsius or from Celsius to Fahrenheit.
The table of conversions is below.
You are to do a functional decomposition here at the very least have methods for input, for processing, and for output. The goal here is for main() to be self-documenting. Follow the examples from class.
You may choose to use JOptionPane for input and output as demonstrated in class.
All output should be well formatted.
A run of your program might look like this (if you were using System.out.println and Scanner) user input is shown in red:
Conversion options:
Length
Volume
Temperature
Which conversion would you like to perform? 1
You have chosen length conversion.
Conversion options:
Inches to centimeters
Centimeters to inches
Which conversion would you like? 2
Enter the number of centimeters: 5
5 centimeters is equal to 1.968505 inches
Conversion Table
Length | |
1 in | 2.54 cm |
1 cm | 0.393701 in |
Volume | |
1 gallon | 3.78541 liters |
1 liter | 0.264172 gallons |
Temperature | |
Celsius | (Fahrenheit 32) * 5 / 9 |
Fahrenheit | Celsius * 9 / 5 + 32 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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