Develop a computer program in the Java language to create classes of Rectangle, Triangle, and Circle that
Fantastic news! We've Found the answer you've been seeking!
Question:
Develop a computer program in the Java language to create classes of Rectangle, Triangle, and Circle that inherit from the generic class called Shape.
??
?
Transcribed Image Text:
PROGRAMMING II: CLASSROOM ACTIVITY (CA-05/06) DUE 5:00 PM FRIDAY MARCH 27, 2020 Following the suggestions from class regarding Classroom Activity assignments, I assign this mini project as your Classroom Activity 5 (CA-05). As indicated at the top of the page, this mini project is due Friday, March 27, 2020 by 5:00 pm. The goal of this project is to gain more in-depth experience with inheritance concepts. You will develop a computer program in the Java language to create classes of Rectangle, Triangle, and Circle that inherit from the generic class called Shape. The class Shape is characterized by the UML diagram shown below. Shape -color: String -filled: boolean +Shape() +Shape(color: String, filled: boolean) +getColor(): String +setColor(color: String): double +getFilled(): boolean) +setFilled(filled: boolean): void +toString(): String The color of this shape (default white) whether filled with a color (default false) Constructs a default Shape Constructs a shape of specified color and filled values Returns the color Sets a new color Returns the filled property Sets the filled property Returns a string representation of this shape Use your favorite IDE to write and run a Java program that performs the tasks described below. Submit the source code on Canvas no later then 5:00 pm Friday, March 27, 2020. 1. Create the driver class named Test Shapes (source code given at the end of this document) in a file named TestShapes.java that will include a total of five classes, named: 1) Test Shapes; 2) Shape; 3) Rectangle; 4) Circle; and 5) Triangle. 2. The class Shape must be created according to the the UML diagram above. Make sure you provide constructor(s), accessor method(s), and mutator method(s). 3. The class Rectangle must be created as a subclass of the Shape class and must contain (in addition to the constructor(s) and accessor and mutator methods for each data field): a. The data field length of type double; b. The data field width of type double; c. The method named get Perimeter () that returns the perimeter of the rectangle as a double; and d. The toString() method that overrides the corresponding method in the Shape class. PROGRAMMING II: CLASSROOM ACTIVITY (CA-05/06) DUE 5:00 PM FRIDAY MARCH 27, 2020 Following the suggestions from class regarding Classroom Activity assignments, I assign this mini project as your Classroom Activity 5 (CA-05). As indicated at the top of the page, this mini project is due Friday, March 27, 2020 by 5:00 pm. The goal of this project is to gain more in-depth experience with inheritance concepts. You will develop a computer program in the Java language to create classes of Rectangle, Triangle, and Circle that inherit from the generic class called Shape. The class Shape is characterized by the UML diagram shown below. Shape -color: String -filled: boolean +Shape() +Shape(color: String, filled: boolean) +getColor(): String +setColor(color: String): double +getFilled(): boolean) +setFilled(filled: boolean): void +toString(): String The color of this shape (default white) whether filled with a color (default false) Constructs a default Shape Constructs a shape of specified color and filled values Returns the color Sets a new color Returns the filled property Sets the filled property Returns a string representation of this shape Use your favorite IDE to write and run a Java program that performs the tasks described below. Submit the source code on Canvas no later then 5:00 pm Friday, March 27, 2020. 1. Create the driver class named Test Shapes (source code given at the end of this document) in a file named TestShapes.java that will include a total of five classes, named: 1) Test Shapes; 2) Shape; 3) Rectangle; 4) Circle; and 5) Triangle. 2. The class Shape must be created according to the the UML diagram above. Make sure you provide constructor(s), accessor method(s), and mutator method(s). 3. The class Rectangle must be created as a subclass of the Shape class and must contain (in addition to the constructor(s) and accessor and mutator methods for each data field): a. The data field length of type double; b. The data field width of type double; c. The method named get Perimeter () that returns the perimeter of the rectangle as a double; and d. The toString() method that overrides the corresponding method in the Shape class.
Expert Answer:
Answer rating: 100% (QA)
Class1 Shape colorString Methods getArea double toString String Superclass defines the expected behaviorspublic intertace of all subclasses Program at ... View the full answer
Related Book For
Principles of Communications Systems, Modulation and Noise
ISBN: 978-8126556793
7th edition
Authors: Rodger E. Ziemer, William H. Tranter
Posted Date:
Students also viewed these programming questions
-
The objective of this project is to take the concepts learned in the course and apply them to your company's annual report. The following is a suggested format to use for this analysis: I. Executive...
-
Develop a computer program and use the program to verify the simulation results shown in Figures 4.24 and 4.25. Figure 4.24 Figure 4.25 80 Af = 40 Hz 60 ww Af = 45 Hz 20 Af = 35 Hz Af= 20 Hz -20 2 4 ...
-
Develop a computer program to verify the performance curves shown in Figure 8.17. Compare the performance of the non-coherent FSK system to the performance of both coherent FSK and coherent PSK with...
-
Assume that you have been hired as a consultant by CGT, a major producer of chemicals and plastics, including plastic grocery bags, styrofoam cups, and fertilizers, to estimate the firms weighted...
-
Comment on the decision of many membership clubs to begin selling gasoline.
-
A one-year gold futures contract is selling for $1,558. Spot gold prices are $1,500 and the one-year risk-free rate is 2%. a. According to spot-futures parity, what should be the futures price? b....
-
A smooth orange ball weighs \(\frac{1}{64} \mathrm{lb}\) (at sea level) and has a diameter of \(1.5 \mathrm{in}\). The discharge of a vacuum cleaner is directed upward and supports the ball...
-
The math department at a small school has 5 teachers. The ages of these teachers are 23, 34, 37, 42, and 58. Suppose you select a random sample of 4 teachers and calculate the sample minimum age....
-
What is the difference between opportunistic Behavior and relationship Behavior?
-
Joe and Jessie are married and have one dependent child, Lizzie. Lizzie is currently in college at State University. Joe works as a design engineer for a manufacturing firm while Jessie runs a craft...
-
If the spacecraft subsystems require the power demands shown below, what is the maximum power available to the payload? Subsystem Power Needs CDHS 12 watts ACS 15 watts TCS 5 watts
-
Fred purchased a small retail center for $350,000. Fred placed $100,000 down and obtained an interest-only loan for $250,000 at 10% annual interest. At the end of one year, the building was sold for...
-
Barker Company had reported the following details for the year ended December 31, 2025: Net sales Total assets Total liabilities $25,650,000 17,300,000 10,600,000 The company's beginning total assets...
-
Adaptability is the predominate tension for a college in these days of intense competition for "customers" (students) and faculty, right?But, be adaptable to what?Wouldn't the college have to develop...
-
What additional factors should be considered when assessing current ratio and liquidity?
-
Company B has an operating profit (EBIT) of 100. It has interest payable of 20. What is the degree of financial gearing?
-
Three circuit elements are connected in series to form a closed loop: an uncharged 2 0 . 0 - mu F capacitor, a 1 0 0 - V DC power supply, and a 1 0 . 0 - M resistor. What is the maximum charge that...
-
Discuss whether responsible human resources management should apply different standards for the home company and suppliers, for developed countries and developing countries, and for large companies...
-
Use MATLAB to plot out-of-band power for M-ary PSK, QPSK (or OQPSK), and MSK. Compare with Figure 10.16. Use trapz to do the required numerical integration. Figure 10.16 -10 BPSK -20 QPSK or OQPSK...
-
Consider a two-hypothesis decision problem where (a) Find the likelihood ratio Î(Z). (b) Letting the threshold n be arbitrary, find the decision regions R 1 and R 2 illustrated in Figure 11.1....
-
An AM modulator has output x c (t) = 40 cos [20(200)t] + 5 cos[2(180)t] + 5 cos[2(220)t] Determine the modulation index and the efficiency.
-
Find each probability using the standard normal distribution. (a) \(P(z>-1.68)\) (b) \(P(z <2.23)\) (c) \(P(-0.47
-
Find the probability that a randomly selected person has an IQ score between 95 and 105. Is this an unusual event? Explain. In a standardized IQ test, scores are normally distributed, with a mean...
-
The random variable \(x\) is normally distributed with the given parameters. Find each probability. (a) \(\mu=9.2, \sigma \approx 1.62, P(x <5.97)\) (b) \(\mu=87, \sigma \approx 19, P(x>40.5)\) (c)...
Study smarter with the SolutionInn App