Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write code using java programming by following these instructions: Use the Rectangle Object Class Model (attached below) to create a set of classes which
Please write code using java programming by following these instructions:
Use the Rectangle Object Class Model (attached below) to create a set of classes which creates an object; the object type is cup; this is an exercise in constructors, get- and set- methods.
Use the code below as reference and make so its for a "cup" instead of a rectangle.
Please include output photo.
chaprar RectangleObjectClassModel.java 11/8/2019 import java.util.*; public class RectangleObject class Model private double lenght, width, aree, perimeter; private static int numberThings = 0; private static Date date = new Date(); !! public RectangleobjectClassModelo Default Constructov lenght = 20; width - 20; numberThings+1; incununted date.getTime(); }//end first constructor public RectangleObjectClassModel (double newLenght, double newwidth) lenght = newLenght; width = new Nidth; number Things++; counting the instance date.getTime(); time instana Los Created !//end second constructor Vited public static int getNumber Things return numberThings; ?//get count of objects public static String getDate() return date.toString(); }//end tostring method public double get Area() area = lenght *width; return area; }//end gelArca () public double getPerimeter perimeter = 2 * (lenght + width); return perimeter 1//end get Perimeter public double get Lenght) return lenght; public double gelWidth() zelurn width; public void setlenght (double newLenght) lenght = newLenght; J//end setLenght) public void setWidth (double newwidth! width = newWidth; }//end setWidth() 1//end class chaprar RectangleObjectClassModel.java 11/8/2019 import java.util.*; public class RectangleObject class Model private double lenght, width, aree, perimeter; private static int numberThings = 0; private static Date date = new Date(); !! public RectangleobjectClassModelo Default Constructov lenght = 20; width - 20; numberThings+1; incununted date.getTime(); }//end first constructor public RectangleObjectClassModel (double newLenght, double newwidth) lenght = newLenght; width = new Nidth; number Things++; counting the instance date.getTime(); time instana Los Created !//end second constructor Vited public static int getNumber Things return numberThings; ?//get count of objects public static String getDate() return date.toString(); }//end tostring method public double get Area() area = lenght *width; return area; }//end gelArca () public double getPerimeter perimeter = 2 * (lenght + width); return perimeter 1//end get Perimeter public double get Lenght) return lenght; public double gelWidth() zelurn width; public void setlenght (double newLenght) lenght = newLenght; J//end setLenght) public void setWidth (double newwidth! width = newWidth; }//end setWidth() 1//end class
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