Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

First design Rectangle and Circle classes following these design specifications: The Rectangle class has 4 private double data members: width, height, x, and y where

First design Rectangle and Circle classes following these design specifications:

The Rectangle class has 4 private double data members: width, height, x, and y where (x,y) determines the point of the upper left hand corner of the rectangle.

The Circle class has 3 private double data members: x, y, and radius where (x,y) determines the center point of the circle.

Constructors for both classes that allow the data members to be populated with values during object creation.

Accessor and mutator methods (Getters and Setters) for each private data member in each class.

A method in each class designed to return the area of the respective shape. In another class called FirstnameLastnameHW1, create a main method that gives the user the following options:

Main Menu

1: Change Circle Radius and Center Point

2: Change Rectangle Width, Height and Point

3: Display Proximity of Rectangle and Circle

4: Display Circle Area

5: Display Rectangle Area

6: Exit

Enter a choice:

Your program should ask the user to define the circle and rectangle data before the menu is displayed to the user for the first time. Options 1 & 2 should allow the user to redefine the rectangle or circle's data stored in the object. Do not create multiple circle and rectangle objects. In other words, only one object of each type should be created by your program. Option 3 in the main menu should determine if the circle is completely contained inside the rectangle, completely outside the rectangle or intersecting the rectangle. If the borders touch at any point they are considered intersecting.

Please answer in java.

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

More Books

Students also viewed these Databases questions