Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This should be in C# The following Homework assignment has you creating the Main class, the apartment class and the place class. In the main,

This should be in C#

The following Homework assignment has you creating the Main class, the apartment class and the place class. In the main, you will create and work with a apartment object. The apartment object has a few places in it as objects. The places have a Length, Width, and a cat variable which is true or false if there is a cat in that place.

*Make sure each class is in its own file with the correct Methods, constructors and data types*

-does not use Inheritance-

The Place class has the following private variables:

double width; double length; bool cat;

The constructor of the Place class should assign random values for all 3 variables. The range for the width and length is 10-25.

The apartement class has the following private variables:

Place topPlaces[]; Place bottomPlaces[];

The constructors for the Apartment class will ask the user how many places are on the top floor and how many are on the bottom floor. In the case of the overloaded constructor, the total number of places comes from the main while on the default constructor you should ask the user. Make sure the number of places on bottom and on top add up to the total number of rooms..if not, you should have them re-enter these values. Make sure you create the actual places at this point by using the Places default constructor.

In the main, you should ask first for the number of places in the apartment (1-6 places only). Create the apartment object at this point, passing the variable to the overloaded constructor for apartment which accepts this variable as the only parameter.

Display all top floor Place dimensions and Areas along with if a cat is in that place. Display all bottom floor Place dimensions and Areas along with if a cat is in that place.

Your program should ask the user for preferred location of place, top or bottom floor. Display to the user the place with the largest area in that floor.

Finally, display how many cats are in the apartment and display this number.

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

Describe the advantages and disadvantages of group BST .

Answered: 1 week ago