Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Develop a Java project of shapes and write a program that computes the amount of paint needed to paint different objects. The project will

JAVA

image text in transcribed

Develop a Java project of shapes and write a program that computes the amount of paint needed to paint different objects. The project will consist of a super class Shape with three derived classes - Circle, Sphere, and Cylinder. The only attribute a shape will have is a name. You are asked to complete the following. 1. Write a class Shape with the following properties: An instance variable shapeName of type String A toString method that returns the name of the shape 2. Write a Paint class which has a "coverage" variable and a method "amountOfPaint" to compute the amount of paint needed to paint a shape. The amount of paint needed is the area of the shape divided by the coverage for the paint. 3. Write three sub classes with the following properties: Circle class is a descendant of Shape class. A Circle has a radius variable and an area method (surface area) is given by the formula Pi*radius2. Define similar classes for a Sphere and a cylinder. Both classes are descendants of the Shape class. A Sphere has a radius variable and the area method is defined by the formula 4*Pl*radius^2. A cylinder is defined by a radius and height and its area (surface area) is Pl*radius^2*height. Define the toString method in a way similar to that for the Sphere class. Each class has an argument constructor to set the data member/s. Each class has an object member of the type Paint. int he constructor of each sub class, the Paint "coverage" value need to be determined. 4. create PaintThings.java file which contains a main method that computes the amount of paint needed to paint various shapes. Instantiate the three shape objects: trampoline to be a Circle of radius 20 feet, bigBall to be a sphere of radius 8 feet, and tank to be a cylinder of radius 10 feet and height 30 feet. All of the objects will use the same paint type where the coverage equal 400 square feet". . find out which Object needs more paint out of all the 3 objects and which one need less

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

=+ Have they changed the way employers view IP?

Answered: 1 week ago