0% found this document useful (0 votes)
7 views1 page

Quiz 02 Self B

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Quiz 02 Self B

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Quiz 02 Sec Self B

December 10, 2024


1) Suppose you are working on an object-oriented module for the installation of household items. Major
Classes are House, Room, Kitchen, Washroom, and Item. Details some of the classes can be seen in
Table 1. The house class keeps a record of the house no, address, contact, rooms, kitchen, washroom,
items, and date of construction. Draw a UML class diagram to show your solution. Briefly explain your
selection of classes and the relationships between the classes. The diagram should show the class names,
variables with data types, and methods with return types for each class. (do not write code). Table1:
Class Attributes
Room Room id, name, size, room items
Kitchen id, name, size, kitchen item
Item Item name, id, price, description, purchase date, sales tax rate.
Washroom Name, id, washroom items
2) Write code for the class declaration and constructor of the House class, initializing the variables
through the constructor. Constructor parameters and instance variables must have the same names.
3) Write piece of code for the str method of the House class, that displays the details of the class using
format method.
4) Now, write piece of code, that:
a) Instantiates an object for each of the classes with values for the relevant attributes.
b) Takes input from the user and rewrites the initial values for the item name and the sales tax
rate using their respective setter methods.
c) How will you display the kitchen size and the name of the item.

You might also like