Java class implementation Implement a Rectangle java class to create the rectangle objects and calculate the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Java class implementation Implement a Rectangle java class to create the rectangle objects and calculate the area of the rectangle objects based on the given UML class diagram. Please just implement the class and the tests in the example table will be executed automatically. ps. rectangle area = width*height -double width -double height +Rectangel() +Rectangel(double, double) +getArea():double +getWidth():double +getHeight():double +setWidth(double):void +setHeight(double):void For example: Rectangle Test Rectangle rec=new Rectangle(); System.out.println(rec.getArea()); Rectangle rec=new Rectangle (1.2,3.5); System.out.println(rec.getArea()); Rectangle rec=new Rectangle(-1.2,3.5); System.out.println(rec.getWidth()+" "+rec.getHeight()); Rectangle rec=new Rectangle(); rec.setWidth (3.5); rec.setHeight (-2.5); System.out.println(rec.getArea()); Answer: (penalty regime: 0 %) Reset answer 1 v public class Rectangle{ 2 3} //please add your code here Result 0.0 4.2 1.2 3.5 8.75 Java class implementation Implement a Rectangle java class to create the rectangle objects and calculate the area of the rectangle objects based on the given UML class diagram. Please just implement the class and the tests in the example table will be executed automatically. ps. rectangle area = width*height -double width -double height +Rectangel() +Rectangel(double, double) +getArea():double +getWidth():double +getHeight():double +setWidth(double):void +setHeight(double):void For example: Rectangle Test Rectangle rec=new Rectangle(); System.out.println(rec.getArea()); Rectangle rec=new Rectangle (1.2,3.5); System.out.println(rec.getArea()); Rectangle rec=new Rectangle(-1.2,3.5); System.out.println(rec.getWidth()+" "+rec.getHeight()); Rectangle rec=new Rectangle(); rec.setWidth (3.5); rec.setHeight (-2.5); System.out.println(rec.getArea()); Answer: (penalty regime: 0 %) Reset answer 1 v public class Rectangle{ 2 3} //please add your code here Result 0.0 4.2 1.2 3.5 8.75
Expert Answer:
Answer rating: 100% (QA)
Rectanglejava public class Rectangle private double width private double height public ... View the full answer
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
123 Compare the purely graphical properties of these two notations, and the ways in which the graphical properties of each display correspond to the information structure being defined. Describe...
-
What is the result of the following? A. [Natural History, Science] B. [Natural History, Science, Art] C. The code does not compile. D. The code compiles but throws an exception at runtime. } import...
-
In a questionnaire-based study, van der Velden, van Loon, Benight, and Eckhardt (2012) looked at factors of mental health among rescue workers before (Time 1) and 3 months after (Time 2) deployment...
-
Lessee Ltd. agreed to a noncancellable lease for which the following information is available: a. The asset is new at the inception of the lease term and is worth $160,000. b. Lease term is four...
-
1. Identify an entrepreneur in your area you would like to interview. 2. Contact the person you have selected and make an appointment. Be sure to explain why you want the appointment and to give a...
-
A manufacturing company has two service and two production departments. Building Maintenance and Factory Office are the service departments. The production departments are Assembly and Machining. The...
-
Lab: Structured Query Language (SQL) Queries with Data Manipulation Language (DML) Assignment Instructions LAB: STRUCTURED QUERY LANGUAGE (SQL) QUERIES WITH DATA MANIPULATION LANGUAGE (DML)...
-
During the year Mike Co. made a significant change in the rate of uncollectibility in its aging schedule of accounts receivable. This change has a material effect on the balance of accounts...
-
Unidad 9. Actividad 1. Qu mtodos cualitativos y qu mtodos cuantitativos para la toma de decisiones recomiendas a una empresa que desea introducir un nuevo producto al mercado? En mximo dos...
-
A rod is measured to be exactly 23.10 cm long using a steel ruler at a temperature of 23.0C. Both the rod and the ruler are placed in an oven with a temperature of 253.0 C where the rod now measures...
-
Provide an example of an appropriate use of public relations in case of IUB.
-
A recreational (open) hot air spherical balloon has a radius of 7.30 m when fully inflated. What is the buoyant force on the balloon? The density of surrounding air is 1.293 kg/m. Enviar Respuesta...
-
Starting from rest at t = 0 s, a wheel undergoes a constant angular acceleration. When t = 2 s, the angular velocity of the wheel is 4.8 rad/s. The acceleration continues until t = 19 s, when the...
-
This is a study on minimum wage and poverty thresholds. I have included the procedure for one year, 2009, below. You will calculate all variables for all years 1968 2013. You will have three graphs....
-
(a) How far away can a human eye distinguish two ear headlights 2.0 m apart? Consider only diffraction effects and assume an eye pupil diameter of 5.0 mm and a wavelength of 550 nm. (b) What is the...
-
Many of the people who work at Pepes (Problem 5) are extremely dedicated to Pepes and have devoted their lives to the company. Others feel that the company is behind the times and should use more...
-
a. Suppose the discount rate in Problem 13a changes to 13 percent (.13). Perform present value analysis using the new discount rate. b. What is your recommendation to Alamo Foods now? c. Explain the...
-
Because you are the systems analyst whom Kit hired, go through the narrative of how Kit Chen Kaboodle, Inc., handles unfilled orders, drawing boxes around each action Kit mentions and circling each...
-
In a(n)________ numbering system, all numeric values are written as sequences of 0s and 1s. a. hexadecimal b. binary c. octal d. decimal
-
What is a program?
-
List the five major components of a computer system.
Study smarter with the SolutionInn App