Write a Java program such that it consists of 2 classes: 1. a class that serves as the driver (contains main()) 2. a class that contains multiple private methods that compute and display a. area of a triangle (need base and height) b area of a circle (use named constant for PI) (need radius) c. area of rectangle (width and length) d. area of a square (side) e. surface area of a solid cylinder (height and radius of base) N.B. You will also need an accessor public method (interface) that is called from the driver. This method should: a. Display a menu of options to the user. (Suggest use switch statement) b. Accept input from the user (keyboard) representing parameter values needed.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 1RQ
icon
Related questions
Question
Write a Java program such that it consists of 2 classes:
1. a class that serves as the driver (contains main())
2. a class that contains multiple private methods that compute and display
a. area of a triangle (need base and height)
b area of a circle (use named constant for PI) (need radius)
c. area of rectangle (width and length)
d. area of a square (side)
e. surface area of a solid cylinder (height and radius of base)
N.B. You will also need an accessor public method (interface) that is called from the driver. This method
should:
a. Display a menu of options to the user. (Suggest use switch statement)
b. Accept input from the user (keyboard) representing parameter values needed.
c. Invoke other [private] methods in the class to perform the necessary area computations
Add comments throughout your code as you deem appropriate.
Transcribed Image Text:Write a Java program such that it consists of 2 classes: 1. a class that serves as the driver (contains main()) 2. a class that contains multiple private methods that compute and display a. area of a triangle (need base and height) b area of a circle (use named constant for PI) (need radius) c. area of rectangle (width and length) d. area of a square (side) e. surface area of a solid cylinder (height and radius of base) N.B. You will also need an accessor public method (interface) that is called from the driver. This method should: a. Display a menu of options to the user. (Suggest use switch statement) b. Accept input from the user (keyboard) representing parameter values needed. c. Invoke other [private] methods in the class to perform the necessary area computations Add comments throughout your code as you deem appropriate.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage