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

  Please write the code in java nbsprecursionimplement a

please write the code in java nbsprecursionimplement a subsetgenerator that generates all subsets of the characters of

  What are the various types of dns servers and their purpose

question 1 what is the role of dns how is it structured and why it is necessary?question 2 what are the different kinds

  Allow the user to display a work history report

The 'report screen' shall:Allow the user to display a work history report for an individual or for all employees for the two weeks prior to the report request.

  Redesign the grading program as an object-oriented design

redesign the grading program as an object-oriented design. We will start with a simple Student class. The student will have a name, an id (as a String) and a set of grades (as doubles)

  Simple java program that implements some basic file

Your code will prompt the user to enter a file name. If this file does not exist the program will produce an error message and exit. Otherwise the program will open the file and read a line from the file, reverse the line, and then print the line to ..

  Write a program that converts date formats

Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12,..., Z for 35. (Hint: use the case..

  Explain the types of malware and the potential impact they

write a 200- to 300-word short-answer response to the following bull describe the types of malware and the potential

  Java program for real estate agent

Write down java program for real estate agent. Program must perform the following tasks: ask users for average house price for the each of past 5 years for single family residence of 1500 square feet.

  Write a program that prompts for and accepts input of test

write a program that prompts for and accepts input of test ggrades that are integers between 0 and 100. For each numerical test grade,  program should display a corresponding letter grade

  Write an array where the user can input 7 temperatures

Write an array where the user can input 7 temperatures; include a 'for' loop. Make sure the temperatures are larger than -100 and smaller than or equal to 120, if not, make sure the user enters a valid number. Make sure the temperature is between the..

  Implement an intrusion detection system in java

You are to implement an intrusion detection system in java. Calculate a threshold for detecting an intrusion. The threshold is 2*(Sums of weights).

  Implements both the quicksort and mergesort algorithms

Write a program that correctly implements both the Quicksort and Mergesort algorithms. The program should generate an array of 500 random numbers in the 1-100 range. The program should sort the same set of numbers and keep time stamps of how long it ..

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