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

  Create java program to describe inheritance and polymorphism

Create a Java program based on the geometric shapes example described at the beginning of this lesson using Classes Square, Triangle, Rectangle, and Circ leto help describe inheritance and polymorphism.

  Inheritancedemo

Create a New Project named InheritanceDemo . 2. Create a new class called Person and cut and paste the Person.java file from Blackboard into the class. Create a new class called Student and cut and paste the Student.java file from Blackboard into the..

  Write program that uses top five countries national wealth

Write a program that uses the top five countries' National Wealth to calculate the average of those five countries.

  Write a java program that uses a search tree of strings

Write a Java program that uses a search tree of strings to sort text lines in alphabetic order. You may choose how you de?ne alphabetic order as long as there is some sense in the de?nition. You may also choose what kind of tree you use.

  Use inheritance to read, store, and print questions for test

use inheritance to read, store, and print questions for a test. First, write an abstract class

  Socket programming modify the translate program and

socket programming modify the translate program and dictionary program. modify the programs to handle multiple user

  Instance methods

instance methods: setWidth(double w), setHeight(double h), double getWidth(), double getHeight() and double getArea() * A triangle's area is calculated by width*height*0.5  * all variables are private and methods public.

  Question superclass and provide a different implementa

Add a method addText to the Question superclass and provide a different implementa- tion of ChoiceQuestion that calls addText rather than storing an array list of choices.

  Program produces 1000 integer ranging

Then your program produces 1000 integer ranging from 1to 10000 in the array and then sort them in ascending order and then print the result into data.txt file. (You may list integers separated by space or new line)

  Java program simulate a network

Java program simulate a network

  Project is for designing and developing a college

project is for designing and developing a college registration program. write a java program to register students for a

  Java project

Prompt the user for an int between lower and upper boundary.

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