The purpose of this assignment is to assess if you can create a program that uses Object Oriented Programming.
Directions
|
Points
|
You must create two Java files. One is called LastNameFirstNameWeek6Prog.java, and the other is called Dwelling.java.
Ensure you include ALL files required to make your program compile and run. I would like to see your .java files only.
|
5%
|
Dwelling.java Class File
1. Create a new class called Dwelling that includes the functionality below
2. The new class has the attributes of: category - dwelling's category (i.e.:"House", "Condo", "Apartment","shach",etc.), type String numberOfBedrooms - the number of bedrooms in the dwelling, type integer numberOfBathrooms - the number of bedrooms in the dwelling, type double to consider half bathrooms area - dwelling's area in sq.ft., type double centralAirCond- type boolean - true if dwelling has air conditioning, false if not
3. Be sure your classes have a good set of accessor and mutator methods. Every member variable must have at least one independent accessor and one independent mutator. (see document on Program help for examples)
- Ensure you use the "this" reference from within this class when referring to every instance variable or instance method of the current object.
|
45%
|
LastNameFirstNameWeek6Prog.java Class File (Driver Program)
Write a driver program that reads information from the user about 3 dwellings and use this info to create 3 respective Dwelling objects. The following information should be read per Dwelling: category numberOfBedrooms numberOfBathrooms area centralAirCond
After this, using the information inside the objects the program should evaluate and print the following output:
- The average area of all the dwellings
- The minimum and maximum number of bathrooms in the dwellings
- The category of the dwelling that is air conditioned with the largest number of bedrooms..
To get the information from the objects, use accessor methods from the Dwelling class. Do not use local variables in main for these calculations.
|
45%
|
NOTE: Complete your activity and submit it by clicking on "Submit Assignment".
|
5%
|
Total Possible Points
|
100
|
Example output of your program
Example Run: Enter the type of Dwelling1: House Enter the number Of bedrooms in Dwelling1: 3 Enter the number of Bathrooms in Dwelling1: 2.5 Enter the area of Dwelling1 in sq.ft.: 3000.0 Is Dwelling1 air conditioned? true or false?: true
Enter the type of Dwelling2: Apartment Enter the number of bedrooms in Dwelling2: 2 Enter the number Of bathrooms in Dwelling2: 1.5 Enter the area of Dwelling2 in sq.ft.: 1200.5 Is Dwelling2 air conditioned? true or false?: false
Enter the type of Dwelling3: Mansion Enter the number of bedrooms in Dwelling3: 5 Enter the number of bathrooms in Dwelling3: 6 Enter the area of Dwelling3 in sq.ft.: 10000.0 Is Dwelling3 air conditioned? true or false?: true
The dwellings average area is: 4733.5sq.ft. The dwellings minimum number of bathrooms is: 1.5 The dwellings maximum number of bathrooms is: 6.0 The dwelling with more bedrooms and air conditioned is: Mansion Press any key to continue . . .
|