188k views
3 votes
You are building a system for a Housing Society, such as Bahria Town. You are supposed to design a very simple system that allows them to keep a record of how many blocks, sectors, streets, and houses the society has.

Your system also generates unique names for blocks and sectors, and unique numbers of streets and
houses.

A society has many blocks (A Link List), each block has many sectors (A link List), each sector has many streets (A link List), and each street has many houses (A link List).

The society has a name, each block has a name (an alphabet), each sector has a name (an alphabet), each street has a number, and each house also
has a unique house number.


Note:
Society is a HEAD NODE.


All Other Node Types can have inherited from Node of type Society. So all nodes can point parent
or child nodes types in any arbitrary order.


When your program starts:
• It asks the user the name of the Society as well as the City in which it is located. Your program
should be able to handle input that has more than one words.
• Then, it asks the user how many blocks does this society has. Let’s say the user says 3. The 3 blocks
are named Block A, Block B, and Block C automatically by your system.
• While creating each Block, you ask the user how many sectors exist in each block. Let’s say that
while creating Block A, the user says that this block has 2 sectors. Your system will automatically
name these sectors Sector A and Sector B.
• While creating each Sector, the system asks the user how many streets the sector has. Let’s say that
while creating the Sector A, the user says that it has 3 streets. Your system will automatically name
these streets Street 1, Street 2, and Street 3.
• While creating a street, the system asks the user how many houses there are in the street. Let’s say
the user says 10 houses for Street 1, your system will automatically name these houses House 1,
House 2, …, House 10. If the user adds 5 houses to Street 2, these houses will be named House 11,
House 12, …, House 15.


No two houses in the society can have the same number. No two streets in the society can have the same
number. No two sectors can have the same alphabet (you can assume that the user won’t ask for more than
26 sectors in total). No two blocks will have the same alphabet (assume total blocks < 26).

1 Answer

4 votes

Final answer:

The question is about creating a record-keeping system for a housing society using object-oriented programming and linked lists to manage a hierarchy of blocks, sectors, streets, and houses with unique identifiers.

Step-by-step explanation:

The student's question pertains to the design and implementation of a simple system for a Housing Society, in this case, a society structured similarly to Bahria Town. This system would employ linked lists to manage a hierarchical storage of blocks, sectors, streets, and houses, with unique identifiers for each.

The functionality of the system includes taking inputs from the user and generating names and numbers for blocks, sectors, streets, and houses accordingly, ensuring that all identifiers within the society are unique.

Upon initializing the program, it prompts the user for the society's name and city, then for the number of blocks, which are automatically named Block A, Block B, and so on. Each block's number of sectors is input, with the sectors named alphabetically.

For each sector, the number of streets is entered, and the streets are automatically numbered. Houses are similarly numbered within streets, ensuring that no two houses share the same number across the entire society. The structuring of this system implies the use of object-oriented programming concepts and data structures.

User Atrujillofalcon
by
8.8k points