Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program #1: Write a program using IF/ELSE statements that displays the following menu and prompt for the user: (write psudeo codes as well) CIRCLE CALCULATOR

  1. Program #1: Write a program using IF/ELSE statements that displays the following menu and prompt for the user: (write psudeo codes as well)

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions