Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started