Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program #1: (ALL programs must be written in JAVA and they need a PSEODOcode) Write a JAVA program using IF/ELSE statements that displays the following
- Program #1: (ALL programs must be written in JAVA and they need a PSEODOcode) Write a JAVA program using IF/ELSE statements that displays the following menu and prompt for the user:
CIRCLE CALCULATOR MENU:
1) Calculate the Area of a Circle
2) Calculate the Circumference of a Circle
3) Quit the Program
Make a selection by choosing a number:
-Store the users selection in a variable named choice of type int.
- -If the user selects choice 1 or 2, the program should next ask the user for the radius of the circle and store that information into a variable named radius.
- If the user selected choice 1, the program should now calculate the area of the circle based on the radius input. (HINT: Use the Math.PI named constant, there is also another Math class method you can use if you would like to).
area = pi * radius * radius
After calculating the area, display it on the screen. Format your result to round to 4 decimal places.
- If the user selected choice 2, the program should now calculate the circumference of the circle based on the radius input. (HINT: Dont forget about the Math.PI named constant).
circumference= 2 * radius * pi
After calculating the circumference, display it on the screen. Format your result to round to 4 decimal places.
- If the user selects choice 3 print a message to the screen that says: You have chosen to quit the program.
- If the user selects a choice other than 1,2, or 3 print an error message that says You have made an invalid selection.
- Program #2: Take program 1 and change it to use the SWITCH/CASE statement
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