Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the correct coding for this Objects and Constructors Define a class of rectangles. Design a class named Rectangle to represent a rectangle. The

What is the correct coding for this image text in transcribed
image text in transcribed
Objects and Constructors Define a class of rectangles. Design a class named Rectangle to represent a rectangle. The class contains: Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1.0 for both width and height. A no-arg constructor that creates a default rectangle. A constructor that creates a rectangle with a specified width and height A method named getArea0 that returns the area of a rectangle. > A method named getPerimeterO that returns the perimeter. Requirements: 1. Draw the UML of the Rectangle class. 2. Implement this class. 3. Write a test program with a main method that should do the following tasks: . Create the first rectangle using the no-arg constructor Create a second rectangle using the constructor's arguments to set the width to 4.0 and the height to 40.0. Print out the area of the first rectangle. Print out the perimeter of the second rectangle. Please note: You must finish this work by the end of the lab period. If you do not finish, please just submit what you have at the end of the lab. Submission: Submit the UML in a word or PDF file and program in a java file in folio using the dropbox folder Lab 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

17. What were the objections made by opponents of the PPACA? LO24.6

Answered: 1 week ago