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...
-
Cover ratios are: a) Indicators of financial sustainability for a project finance deal. b) Profitability indicators for a project finance deal. c) Profitability indicators for debt capital providers,...
-
Copy the table below and place a tick or cross in each box as appropriate. Uses energy in the form of ATP Process Uses proteins Specific Controllable by cell diffusion osmosis facilitated diffusion...
-
Monthly City Temperatures The data file CityTemps contains the average monthly temperature (in ${ }^{\circ} \mathrm{C}$ ) for the cities of Moscow (Russia), Melbourne (Australia), and San Francisco...
-
You are the accountant for Rolla Inc. (Rolla). For each of the following situations, prepare the necessary adjusting entries. Also show the related transactional entries and the date the entries...
-
What do you believe are the main differentiators between Core, Core Plus, Value Add and Opportunistic apartment communities? Do you believe it is better to lease student housing by the unit or by...
-
Antonio is a scientist who has patented a new process for making Covid-19 anti-viral drugs. On 1 January 2023, Antonio registered a company with ASIC called AV-Covid 19 Pty Ltd. Antonio is the sole...
-
Oriole Paper Products purchased 12,000 acres of forested timberland in March 2025. The company paid $2,040 per acre for this land, which was above the $960 per acre most farmers were paying for...
-
1. How have Shell's actions helped facilitate the acculturation challenge for the company's employees and their families? 2.What additional benefits accrue to Shell besides taking better care of...
-
1) Describe each of three levels or categories of analytics that are most often viewed as sequential and independent, but also occasionally seen as overlapping (Descriptive, Predictive, and...
-
The FAA is investing heavily into the NextGen technology. Adding satellite based routing and approaches. What is the rest of the world doing to foster the harmonization in air traffic management?...
-
Questions (inclusive) are structured essay questions. Please USE the full ILAC method when answering questions . Make sure cite relevant sections and sub-sections of legislation and/or case law to...
-
Focuses on the justification of the chosen solutions to key stakeholders - Review and use external research to demonstrate potential results, solution reliability, and validity - Review actual...
-
Law enforcement is a demanding and stressful job for officers and their families. Law enforcement officers endure long hours, lack of sleep and public criticism. These factors create the perfect...
-
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.
-
Number of cars crossing the Golden Gate Bridge each hour. State whether the data described are discrete or continuous and explain why?
-
The times required by students to complete a statistics test. State whether the data described are discrete or continuous and explain why?
-
Body temperatures in Fahrenheit of all students in a statistics class. Identify the level of measurement (nominal, ordinal, interval, or ratio).
Study smarter with the SolutionInn App