ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 9 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 09 May 2017 My Price 9.00

The character code, ‘C’ or ‘S’, is used to distinguish between circle and square shapes.

Write a Java program that will display the following menu until the exit choice (#4) is selected by the user (See Sample Program Run below). The program will calculate the areas and perimeter or circumference by calling only two functions and passing two parameters: a numeric value (side), and a character code to each function.

Program Requirements:

1.The character code, ‘C’ or ‘S’, is used to distinguish between circle and square shapes.

2.  calcArea() will accepttwo parametersand return the area of the shape (either the circle or the square depending on the character code received).

3.calcPerim()will accepttwo parametersand return the perimeter or circumference of the shape (either the circle or the square depending on the character code received).

4.Themain()functionwill display a message which identifies the selected shape and its area or perimeter/circumference, depending upon the selected option.

5.PIshould be declared as a constant.

 

--------------------------------------------------------------------------------------------------------------------------
Sample Program Run: (USER INPUT appears in BOLD and RED.)

 

Geometric Calculator

Choose one of the following options:

 

Press 1 to enter the side or radius and shape code.

Press 2 to display the area.

Press 3 to display the perimeter or circumference.

Press 4 to exit.

Enter selection:  1

Please enter a value for radius or side:10.0

Please enter the shape code (c/C for circle, s/S for square): s

Press 1 to enter the side or radius and shape code.

Press 2 to display the area.

Press 3 to display the perimeter or circumference.

Press 4 to exit.

Enter selection:  2

The area of a square with a side of 10 is: 100.00

Press 1 to enter the side or radius and shape code.

Press 2 to display the area.

Press 3 to display the perimeter or circumference.

Press 4 to exit.

... (More testing must be included here)

Enter selection:  4

Thank you for using the geometric calculator. Bye!

Answers

(11)
Status NEW Posted 09 May 2017 07:05 AM My Price 9.00

-----------

Not Rated(0)