Big Java, Binder Ready Version: Early Objects
Big Java, Binder Ready Version: Early Objects
6th Edition
ISBN: 9781119056447
Author: Cay S. Horstmann
Publisher: WILEY
Question
Book Icon
Chapter 8, Problem 7PE
Program Plan Intro

Volume and Surface area

Program plan:

Filename: “Cone.java”

This code snippet creates a class “Cone”. In the code,

  • Define a class “Cone”.
    • Declare the class variables “radius” and “height”.
    • Define the constructor “Cone”.
      • Set the values of class members.
    • Define the method “getVolume()”.
      • Calculate the volume of cone and return the value.
    • Define the method “getSurface()”.
      • Calculate the surface area and return the value.

Filename: “Cylinder.java”

This code snippet creates a class “Cylinder”. In the code,

  • Define a class “Cylinder”.
    • Declare the class variables “radius” and “height”.
    • Define the constructor “Cylinder”.
      • Set the values of class members.
    • Define the method “getVolume()”.
      • Calculate the volume of cone and return the value.
    • Define the method “getSurface()”.
      • Calculate the surface area and return the value.

Filename: “Sphere.java”

This code snippet creates a class “Sphere”. In the code,

  • Define a class “Sphere”.
    • Declare the class variables “radius”.
    • Define the constructor “Sphere”.
      • Set the values of class member.
    • Define the method “getVolume()”.
      • Calculate the volume of cone and return the value.
    • Define the method “getSurface()”.
      • Calculate the surface area and return the value.

Filename: “Cube.java”

This code snippet creates a class “Cube”. In the code,

  • Define a class “Cube”.
    • Declare the class variables “height”.
    • Define the constructor “Sphere”.
      • Set the values of class member.
    • Define the method “getVolume()”.
      • Calculate the volume of cube and return the value.
    • Define the method “getSurface()”.
      • Calculate the surface area and return the value.

Filename: “GeometryDemo.java”

This code snippet creates a class “GeometryDemo”. In the code,

  • Import the required packages.
  • Define a class “GeometryDemo”.
    • Define the “main” method.
      • Define the object of class “Scanner”.
      • Prompt the user to enter the radius.
      • Scan for “radius”.
      • Prompt the user to enter the height.
      • Scan for “height”.
      • Define the object of class “Sphere”.
      • Define the object of class “Cone”.
      • Define the object of class “Cube”.
      • Define the object of class “Cylinder”.
      • Call the method “getVolime()” to print the volume of sphere.
      • Call the method “getSurface()” to print the surface area of sphere.
      • Call the method “getVolime()” to print the volume of cylinder.
      • Call the method “getSurface()” to print the surface area of cylinder.
      • Call the method “getVolime()” to print the volume of cone.
      • Call the method “getSurface()” to print the surface area of cone.
      • Call the method “getVolime()” to print the volume of cube.
      • Call the method “getSurface()” to print the surface area of cube.

Blurred answer
Students have asked these similar questions
Suppose your computer is responding very slowly to information requests from the Internet. You observe that your network gateway shows high levels of network activity even though you have closed your e-mail client, Web browser, and all other programs that access the Internet. What types of malwares could cause such symptoms? What steps can you take to check whether malware has gained access to your system? What tools can you use at each step? If you identify malware, what ways might it have entered your system? How can you restore your PC to safe operation, including the special software tools you may use?
R language
Using R language

Chapter 8 Solutions

Big Java, Binder Ready Version: Early Objects

Ch. 8.3 - Prob. 11SCCh. 8.3 - Prob. 12SCCh. 8.3 - Suppose we want to enhance the CashRegister class...Ch. 8.3 - Consider an Employee class with properties for tax...Ch. 8.3 - Suppose the setName method in Section 8.3.4 is...Ch. 8.3 - Prob. 16SCCh. 8.4 - Name two static variables of the System class. Ch. 8.4 - Prob. 18SCCh. 8.4 - The following method computes the average of an...Ch. 8.4 - Harry tells you that he has found a great way to...Ch. 8.5 - Prob. 21SCCh. 8.5 - Prob. 22SCCh. 8.5 - Prob. 23SCCh. 8.5 - Consider the task of finding numbers in a string....Ch. 8.6 - Prob. 25SCCh. 8.6 - Is a Java program without import statements...Ch. 8.6 - Suppose your homework assignments are located in...Ch. 8.7 - Provide a JUnit test class with one test case for...Ch. 8.7 - Prob. 29SCCh. 8 - Prob. 1RECh. 8 - Prob. 2RECh. 8 - Your task is to write a program that simulates a...Ch. 8 - Prob. 4RECh. 8 - Your task is to write a program that computes...Ch. 8 - Prob. 6RECh. 8 - Suppose an Invoice object contains descriptions of...Ch. 8 - Suppose a vending machine contains products, and...Ch. 8 - Prob. 9RECh. 8 - Prob. 10RECh. 8 - Classify the methods of the class Scanner that are...Ch. 8 - Prob. 12RECh. 8 - Is the Resistor class in Exercise P8.12 a mutable...Ch. 8 - Which of the following classes are...Ch. 8 - Which of the following classes are...Ch. 8 - Prob. 16RECh. 8 - Prob. 17RECh. 8 - Prob. 18RECh. 8 - Consider the following method that is intended to...Ch. 8 - How can you write a method that swaps two...Ch. 8 - Prob. 21RECh. 8 - Prob. 23RECh. 8 - Look at the methods in the Integer class. Which...Ch. 8 - Prob. 25RECh. 8 - Consider the task of fully justifying a paragraph...Ch. 8 - Prob. 27RECh. 8 - Prob. 28RECh. 8 - Prob. 29RECh. 8 - Prob. 30RECh. 8 - Implement the Coin class described in Section 8.2....Ch. 8 - Modify the giveChange method of the CashRegister...Ch. 8 - Real cash registers can handle both bills and...Ch. 8 - Reimplement the BankAccount class so that it is...Ch. 8 - Reimplement the Day class of Worked Example 2.1 to...Ch. 8 - Write static methods public static double...Ch. 8 - Prob. 7PECh. 8 - Modify the application of How To 7.1 so that it...Ch. 8 - Prob. 9PECh. 8 - Prob. 10PECh. 8 - Prob. 11PECh. 8 - Prob. 12PECh. 8 - Prob. 13PECh. 8 - Prob. 14PECh. 8 - Prob. 15PECh. 8 - Prob. 16PECh. 8 - Prob. 17PECh. 8 - Prob. 18PECh. 8 - Place a BankAccount class in a package whose name...Ch. 8 - Prob. 22PECh. 8 - Prob. 23PECh. 8 - Add a method ArrayList<Double> getStatement() to...Ch. 8 - Prob. 25PECh. 8 - Prob. 26PECh. 8 - Prob. 1PPCh. 8 - Prob. 2PPCh. 8 - Prob. 3PPCh. 8 - Prob. 4PPCh. 8 - Prob. 5PPCh. 8 - For faster sorting of letters, the U.S. Postal...Ch. 8 - Implement a program that prints paychecks for a...Ch. 8 - Prob. 8PPCh. 8 - The Downtown Marketing Association wants to...Ch. 8 - Design a class Cannonball to model a cannonball...Ch. 8 - Continue Exercise P8.10, and draw the trajectory...Ch. 8 - The colored bands on the top-most resistor shown...Ch. 8 - Prob. 13PPCh. 8 - Prob. 14PP
Knowledge Booster
Background pattern image
Similar questions
SEE MORE 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