Implement the getperimeter that returns the perimeter

Assignment Help JAVA Programming
Reference no: EM13494585

The following diagram shows the abstract class GeometricObject.
public abstract class GeometricObject {
private String color = "white";
private boolean filled;
/** Return color */
public String getColor() {
return color;
}
/** Set a new color */
public void setColor(String color) {
this.color = color;
}
/** Return filled. Since filled is boolean,
so, the get method name is isFilled */
public boolean isFilled() {
return filled;
}
/** Set a new filled */
public void setFilled(boolean filled) {
this.filled = filled;
}
/** Return a string representation of this object */
public String toString() {
return "\ncolor: " + color + " and filled: " + filled;
}
/** Abstract method getPerimeter */
public abstract double getPerimeter();
}

(a) Design a class named Triangle that extends GeometricObject. The class contains three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. Implement the getPerimeter() that returns the perimeter of this triangle

(b) Re-design the class Triangle that also implements Comparable. The triangles are compared in terms of their perimeters.

(c)

Design a new class named Polygon that extends GeometricObject and implements Comparable. The number of sides in polygons varies, you cannot use a certain number of data fields for sides of a polygon. For example a triangle is seen as a polygon with three sides and a rectangle is a polygon of four sides. Please use a List of Double values to denote the length of each side of a polygon. Implement the getPerimeter() that returns the perimeter of this triangle

Reference no: EM13494585

Questions Cloud

Classification of mike''s bad debt deduction : 2- Ron sell his business accounts receivable of $100,000 to Mike for $70,000 (70% of the actual accounts receivable). Mike later determines that he will be able to collect only $6,000 $10,000 receivable. Discuss the amount and classification o..
A combustion of the french fries the water has a temperature : A 250.0 g sample of french fries is placed in a calorimeter with 500.0 g of water and an initial temperature of 21.0 C. After combustion of the french fries the water has a temperature of 48.0 C
How fast is the student going at the bottom of the slide : A student, starting from rest, slides down a water slide. On the way down, a kinetic frictional force (a nonconservative force) acts on her.  how fast is the student going at the bottom of the slide
Explain the molecular electron configuration : For N2 1- draw the molecular orbital energy diagram showing electrons 2- give the molecular electron configuration 3- give the bond order for the molecule 4- predict if the molecule will be magnetic
Implement the getperimeter that returns the perimeter : Design a class named Triangle that extends GeometricObject. The class contains three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. Implement the getPerimeter that returns the perim..
Compute the gain or loss on the immediate sale of the old : Part 1: Compute the gain or loss on the immediate sale of the old scanner.
Prepare a multiplc-step income statement : The amount of income taxes applicable to ordinary income was $48,600, excluding the tax effect of the earthquake loss which amounted to $18,000.
Define reactions would be spontaneous : From the values of ?H and ?S, predict which of the following reactions would be spontaneous at 25 degrees celsius. Reaction A: ?H = 10.5 kj/mol, ?S = 30.0 J/K*mol Reaction B: ?H = 1.8 kj/mol, ?S = -113 J/K*mol
What is the angular speed of the record : A horizontal vinyl record of radius 0.11 m rotates about a vertical axis through its center with an angular speed of 4.7 rad/s. What is the angular speed of the record immediately after the putty sticks to it

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd