Create a client program that uses all

Assignment Help JAVA Programming
Reference no: EM131587654

Inheritance Programs

Part 1
Number 3 on page 719 which creates a Point class with 2 instance variables; the xCoordinate and yCoordinate. It should have a default constructor and a values constructor. Also include a set method that sets both attributes, a get method for each attribute, and a method that redefines toString() to print the attributes as follows.
point: (x, y)

Part 2
Do number 4 on page 719 which creates a Circle class that extends the Point class above. It adds the radius, circumference, and area instance variables. It should have a default constructor and a values constructor (circumference and area will be 0.0). Include a set method that sets the coordinates and radius attributes, get methods that get each of the 3 new attributes, and a method that redefines toString() to print all attributes. Also, include methods to calculate the circumference and area of the circle. Use pie = 3.141593. Make sure your methods don't repeat the code already written in the Point class.
Circumference = 2pier
Area = pier2

Part 3
Do number 5 on page 719 which creates a Cylinder class that extends the Circle class above. It adds the height, surfaceArea, and volume instance variables. It should have a default constructor and a values constructor (circumference and circleArea will be calculated from the Circle class, surfaceArea and volume will be 0.0). Include a set method for the center point coordinates, radius, height, circumference, and circleArea attributes (circumference and circleArea will be calculated from the Circle class), get methods that get each of the 3 new attributes, and a method that redefines toString() to print all attributes. Also, include methods to calculate the surfaceArea and volume of the cylinder. Make sure your methods don't repeat the code already written in the Circle class.
surfaceArea = 2 * circleArea + circleCircumference * cylinderHeight
volume = circleArea * cylinderHeight
Hints:
1.In the values constructor and the set method you'll need to call the methods to calculate circumference and area so that they have values to use in calculating the surface area and volume.
2.The methods in the Circle class to calculate circumference and area will need to return those values for use in the Cylinder class.

Part 4
Create a client program that uses all 3 of the classes created above. Make it do the following in this order:
1.Instantiate point1 with the default constructor.
2. Instantiate point2 with the values constructor.
3. Use the Point class print method to print point1 and point2.
4. Call the set method to set the x and y coordinates for point1.
5. Use the get methods to get the attributes for point1 and print them in the client (not with the print method).
6. Instantiate circle1 with the default constructor.
7. Instantiate circle2 with the values constructor.
8. Call the methods to calculate the circumference and area for circle2.
9. Use the Circle class print method to print attributes for circle1 and circle2.
10. Use the set method to set the coordinates and radius for circle1.
11. Call the methods to calculate the circumference and area for circle1.
12. Use the get methods to get the attributes for circle1 and print them in the client (not with the print method).
13. Instantiate cylinder1 with the default constructor.
14. Instantiate cylinder2 with the values constructor.
15. Call the methods to calculate the surfaceArea and volume for cylinder2.
16. Use the Cylinder class print method to print the attributes for cylinder1 and cylinder2
17. Call the set method to set the attributes for cylinder1.
18. Call the methods to calculate the surfaceArea and volume for cylinder1.
19.Use the get methods to get the attributes for cylinder1 and print them in the client (not with the print method).

Reference no: EM131587654

Questions Cloud

Find quantities of capital that minimize total cost to firm : Application exercise. Suppose that the total cost, C, of producing q0 = 100 units of output by a firm is given by the function C = f (k,l) = 0.2k + 5l.
How did media shape your perspective of product advertised : What was the experience like and how did it shape your perspective of the product advertised? Can advertisers go too far in the realm of "shock advertising"?
State the approximate worst-case running time : If you are unsure of one of the calls into the Java Platform APIs, think about how the method might be implemented, and/or read its documentation.
What is your vision of a fair and just society : What is your vision of a fair and just society. How close does the United States fit this vision
Create a client program that uses all : Create a client program that uses all 3 of the classes created above - Use the get methods to get the attributes for cylinder1 and print them in the client
What are three types of opportunities for sharing a sound : What are three types of opportunities for sharing a sound basis for diversification or vertical integration? Give example of each from companies you have read.
Purpose of creating a template : What is the purpose of creating a template? Describe the features of a professional presentation. What screen features would make the presentation.
Prepare the journal entry to record the exchange : Flounder Company traded a used welding machine for office equipment with an estimated fair value of $6,900. Prepare the journal entry to record the exchange
Twos complement integers : Add the following 16 bit twos complement integers: 4555 + 3242. State whether there is a carry and/or an overflow and give the final result in base 10 format.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write java class that declares named constant to hold number

Write a Java class that declares a named constant to hold the number of quarts in a gallon (4). Also declare a variable to represent the number of quarts needed for a painting job, and assign an appropriate value-for example, 18.

  Implement java code for these sub-menu items

300581: Programming Techniques - Implement Java code for these sub-menu items -the program must display the complete library of movies to the screen in an appropriate readable format. Display the movie title, duration, genre, classification and rat..

  Implement the basic properties of a bank account

Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the subsequent data:

  Write various bindings to determine semantics

Write the various bindings that are required to determine the semantics when statement is executed. For each binding, indicate binding time used for language. Describe your answer.

  Java tv''s newest owner! java tv is the greatest tv channel

Java TV's newest owner! Java TV is the greatest TV channel ever, and it prides itself in its 24 hour interesting ' programming'. To help you run this channel you will need to write a  dynamic  program that uses  Data Lists  to store all its TV show i..

  Which parts of the assignment were you not able to complete

Which parts of the assignment were you not able to complete fully? For each, explain why you were unable to complete this part and what steps you took to attempt to complete it. Give me as much detail as possible such that I may award partial cred..

  Write a java application to display the following gui

Write a Java application to display the following GUI. At this point you are only implementing the display. We are not ready to make the calculator actually do any calculations

  Was the code does syntactically right

Access the array 4 Java program. Code, compile, and run the program. There are four lines of code marked (1)..(4) that you must explain after analyzing the code, running the program, and examining the output.

  Write a class harvardlawyer to accompany

Write a class HarvardLawyer to accompany the other law firm classes described in this chapter (Ch 9 of Building java programs; a back to basic approach).

  What could you do to kill more mutants

What are the implications related to suite of unit test cases when some mutants are not killed and What could you do to kill more mutants?

  A listener for the click events of a button

What happens if you fail to register an object as a listener for the click events of a button?

  Calculate the area of a square

Create a simple web application to calculate the area of a square, rectangle, triangle, or the circumference of a circle using the options

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd