Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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).

Java, Programming

  • Category:- Java
  • Reference No.:- M92396368
  • Price:- $15

Priced at Now at $15, Verified Solution

Have any Question?


Related Questions in Java

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As