Question: 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

  1. 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.

  1. 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

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 Databases Questions!