Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
### Java Programming Exercise: Creating a Class for Area Calculations

This exercise involves writing a Java program consisting of two classes:

1. **Driver Class**: 
   - Contains the `main()` method.

2. **Computation Class**:
   - Includes private methods to compute and display:
     1. **Area of a Triangle**: Requires base and height.
     2. **Area of a Circle**: Use a named constant for PI; requires radius.
     3. **Area of a Rectangle**: Requires width and length.
     4. **Area of a Square**: Requires side length.
     5. **Surface Area of a Solid Cylinder**: Requires height and radius of the base.

#### Implementation Details

- **Public Method (Interface)**:
  - Called from the driver class.
  - Should:
    a. Display a menu of options to the user (suggest using a switch statement).
    b. Accept input from the user representing parameter values needed.
    c. Invoke private methods in the class to perform the necessary area computations.

- **Additional Instructions**:
  - Add comments throughout your code as appropriate for clarity.

This program will help in understanding the concepts of classes, methods, and user interaction in Java.
expand button
Transcribed Image Text:### Java Programming Exercise: Creating a Class for Area Calculations This exercise involves writing a Java program consisting of two classes: 1. **Driver Class**: - Contains the `main()` method. 2. **Computation Class**: - Includes private methods to compute and display: 1. **Area of a Triangle**: Requires base and height. 2. **Area of a Circle**: Use a named constant for PI; requires radius. 3. **Area of a Rectangle**: Requires width and length. 4. **Area of a Square**: Requires side length. 5. **Surface Area of a Solid Cylinder**: Requires height and radius of the base. #### Implementation Details - **Public Method (Interface)**: - Called from the driver class. - Should: a. Display a menu of options to the user (suggest using a switch statement). b. Accept input from the user representing parameter values needed. c. Invoke private methods in the class to perform the necessary area computations. - **Additional Instructions**: - Add comments throughout your code as appropriate for clarity. This program will help in understanding the concepts of classes, methods, and user interaction in Java.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education