Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 ( 3 6 points ) Java Programing: In the code provided below, you will find the class GeometricObject and Triangle. Study the code
Question points
Java Programing:
In the code provided below, you will find the class GeometricObject and Triangle. Study the code well and then implement the required classes below. You can complete your implementation within this code as directed. The requirements are shown below the code
public abstract class GeometricObject
private String color "white";
private boolean filled;
private java.util.Date dateCreated;
Construct a default geometric object
protected GeometricObject
dateCreated new java.util.Date;
Construct a geometric object with color and filled value
protected GeometricObjectString color, boolean filled
dateCreated new java.util.Date;
this.color color;
this.filled filled;
Return color
public String getColor
return color;
Set a new color
public void setColorString color
this.color color;
Return filled. Since filled is boolean,
the get method is named isFilled
public boolean isFilled
return filled;
Set a new filled
public void setFilledboolean filled
this.filled filled;
Get dateCreated
public java.util.Date getDateCreated
return dateCreated;
@Override
public String toString
return "created on dateCreated
color: color
and filled: filled;
Abstract method getArea
public abstract double getArea;
Abstract method getPerimeter
public abstract double getPerimeter;
class Triangle extends GeometricObject
private double side side side;
Constructor
public Triangle
Constructor
public Triangledouble side double side double side
this.side side;
this.side side;
this.side side;
Override method findArea in GeometricObject
public double getArea
double s side side side;
return Math.sqrts s sides sides side;
Override method findPerimeter in GeometricObject
public double getPerimeter
return side side side;
Override the toString method
public String toString
Implement it to return the three sides
return "Triangle: side side side side
side side;
class Test
public static void mainString args
GeometricObject gObjectArray new GeometricObject ;
Complete your code here
private static void printAreaAndPerimeterGeometricObject gObject
Complete your code here
Implement the classes Circle, EquilateralTriangle, Rectangle, and Square.
Implement the method printAreaAndPerimeter in the Test class that prints the area and the perimeter of the passed GeometricObject.
In the Test class, create an array of GeometricObject of size The first element should be assigned to a Circle object: new Circle The second element should be assigned to an EquilateralTriangle object: new EquilateralTriangle The third element should be assigned to a Triangle object: new Triangle The fourth element should be assigned to a Rectangle object: new Rectangle The fifth element should be assigned to a Square object: new Square
Pass each element in the array to printAreaAndPerimeter.
Compile, Run, and take a screenshot of the output and submit to Blackboard you must submit the program regardless whether it complete or incomplete, correct or incorrect
Questions points
Modelling: State Diagram
Draw a state diagram that models a BankAccount object: a bank account can either have enough cash or be out of cash. If the account is out of cash, it will allow for money to deposited. If the account has enough cash, it will allow for money to be deposited and withdrawn. The account is out of cash if the amount in the account is below a predetermined minimum.
Questions points
Modelling: Activity Diagram
In an online purchasing system, the buyer requests to buy an item. In parallel, the system looks up whether the item exists in the store and verifies if the buyer has an account with the system. If the buyer does not have an account, the system will ask for registration info from the buyer to open an account. If the buyer does not provide registration info, the system exits. If the item does not exist in the store, the system exits. If the item exists, the system will check if the item price is less than or equal to buyers account balance. If the buyer has enough money in the account to purchase the item, the system completes the purchase order successfully. If the buyer does not have enough money, the system exits.
Deliverables:
pdf file containing Screenshots of the
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