This program will give the user two options – to convert centimeters to inches, inches to centimeters, or to exit.  Ask the user if they’d like to convert cm to inches, inches to cm, or if they’d like to exit. If they choose to convert, ask them for their numeric input, do the math, and output the result to them. The loop should then repeat and the menu should be reprinted for them to select again. If they choose to exit, the program should end cleanly. (“Cleanly” means we do not ask for more input or do any math. However, you are encouraged to add a “goodbye” statement.) If they choose an invalid option for the menu, tell them that they entered an invalid option, reprint the menu, and let them enter again. You do not have to account for negative centimeters. Simply do the math and let a negative answer be given. Use a while loop to complete this program. Consider using an if/else statement inside your loop.  Consider using a Boolean variable to control the loop.  Program should be able to accept real numbers and output should be decimal formatted.   Sample output:   This program will convert units of measurements   Type 1 if you want to convert cm to inches. Type 2 if you want to convert inches to cm. Type 3 if you want to exit the program. >>>1 Enter your number in centimeters: >>>30.0 This is equal to 11.81 inches.   Type 1 if you want to convert cm to inches. Type 2 if you want to convert inches to cm. Type 3 if you want to exit the program. >>>2 Enter your number in inches: >>>100 This is equal to 254.00 cm.   Type 1 if you want to convert cm to inches. Type 2 if you want to convert inches to cm. Type 3 if you want to exit the program. >>>5 Invalid Input.   Type 1 if you want to convert cm to inches. Type 2 if you want to convert inches to cm. Type 3 if you want to exit the program. >>>3 Goodbye. in java

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This program will give the user two options – to convert centimeters to inches, inches to centimeters, or to exit. 

  1. Ask the user if they’d like to convert cm to inches, inches to cm, or if they’d like to exit.
  2. If they choose to convert, ask them for their numeric input, do the math, and output the result to them. The loop should then repeat and the menu should be reprinted for them to select again.
  3. If they choose to exit, the program should end cleanly. (“Cleanly” means we do not ask for more input or do any math. However, you are encouraged to add a “goodbye” statement.)
  4. If they choose an invalid option for the menu, tell them that they entered an invalid option, reprint the menu, and let them enter again.
  5. You do not have to account for negative centimeters. Simply do the math and let a negative answer be given.
  6. Use a while loop to complete this program. Consider using an if/else statement inside your loop.  Consider using a Boolean variable to control the loop.  Program should be able to accept real numbers and output should be decimal formatted.

 

Sample output:

 

This program will convert units of measurements

 

Type 1 if you want to convert cm to inches.

Type 2 if you want to convert inches to cm.

Type 3 if you want to exit the program.

>>>1

Enter your number in centimeters:

>>>30.0

This is equal to 11.81 inches.

 

Type 1 if you want to convert cm to inches.

Type 2 if you want to convert inches to cm.

Type 3 if you want to exit the program.

>>>2

Enter your number in inches:

>>>100

This is equal to 254.00 cm.

 

Type 1 if you want to convert cm to inches.

Type 2 if you want to convert inches to cm.

Type 3 if you want to exit the program.

>>>5

Invalid Input.

 

Type 1 if you want to convert cm to inches.

Type 2 if you want to convert inches to cm.

Type 3 if you want to exit the program.

>>>3

Goodbye.

in java

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Basics of loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education