Code in C++, use classes and comment on the code, please
Scenario
The users will be able to set the number of floors on the building, the number of offices on each floor, the rent of each office per month at the start of the program. They will be able to see the number of empty offices in total within the building and as well as the number of offices available per floor. They will also be able to exit the program if they wish to for exiting the program. The users will be able to add , modify , delete records for the building with certain commands which will be listed at the start of the program. The details of each office will be asked :
the name of the Office
A description of the office
monthly fee (setting the date of the first payment)
the yearly fee will be shown as well as the date of the next monthly payment.
Output of the Program- Do not forget to comment please
Hi welcome to the work Environment!!
------------------------------------
Enter the number of floors in the building: 3
Enter the number of offices per floor : 2
----------------------------------------- *Number of underscores
should be equivalent to the total number of spaces the input +
output values
Floor: 1
-----------
Would You like to occupy an office on floor: 1(number of offices
available: 2) : Yes * The program should keep on going if the user
input capslock or lowercase characters for (Yes)
-------------------------------------------------------------------------------------------
Enter a monthly fee: 2000
What is the name of the office: Orthodontist
Description of the office: Best Orthodontist on the market!!!
Set the first date of payment (dd/mm/yyyy): 12/13/2020 *The date is
incorrect so asks for the date once again
Invalid date!
Re-type the date(dd/mm/yyyy): 12/12/2020
----------------------------------------
Would You like to occupy another office on floor: 1(number of
offices available: 1) : No * Number of offices are decreased to
1
-----------------------------------------------------------------------------------------------------------------------------------
Moving onto floor: 2!!
----------------------
Would You like to occupy an office on floor: 2 (number of offices
available: 2) : YES
--------------------------------------------------------------------------------------------
Enter a monthly fee: -5000
Re-Enter the monthly fee: 5000
What is the name of the office: 2
Re-Enter the office name: Sushi market
Description of the office: Nice Seafood : )
Set the first date of payment (dd/mm/2020): 04/02 * From the first
date inputted it keeps track of the date
-----------------------------------------------------------------------------------------------------------
Would You like to occupy another office on floor: 2(number of
offices available: 1) : YES
-------------------------------------------------------------------------------------------------
Enter a monthly fee: 4000
What is the name of the office: Burger King
Description of the office: We sell Burgers : )
Set the first date of payment (dd/mm/2020): 05/08
-------------------------------------------------
Moving onto floor: 3!!
----------------------
Would You like to occupy an office on floor: 3(number of offices
available: 2) : No
-----------------------------------------------------------------------------------
Congrats!! you have completed the interface of the building!!
Use the following commands to make changes to the interface of the
building:
building outline: -building
floor access: -floor[floornumber]
exit program: -exit
Go ahead Make changes!: -room
Unknown Comman Please Type a valid Command: -building
-----------------------------------------------------
Building Outline
----------------
1 office occupied on floor 1 : Orthodontist
2 offices occupied on floor 2 : Sushi market, Burger King
No office occupied on floor 3 :
--------------------------------------------------------
Any other changes [-building, -floor[floornumber], -exit]:
-floor1
------------------------------------------------------------------
This is the outline of floor 1:
Number of offices occupied= 1
Number of offices empty= 1
Would you like to make any changes to floor 1: Yes
what would you like to do:
Add a office: -Add
Remove an office: -Remove
Change an office: -Change
Details: -Details
Your input: - Add
-----------------
Enter a monthly fee: 4200
What is the name of the office: Taco Bell
Description of the office: Tacos
Set the first date of payment (dd/mm/2020): 01/12
------------------------------------------------
Any other changes [-building, -floor[floornumber], -exit]:
-building
--------------------------------------------------------------------
Building Outline
----------------
1 office occupied on floor 2 : Orthodontist,Taco bell
2 offices occupied on floor 2 : Sushi market, Burger King
No office occupied on floor 3 :
-------------------------------
Any other changes [-building, -floor[floornumber], -exit]:
-floor1
--------------------------------------------------------------------
This is the outline of floor 1:
Number of offices occupied= 2
Number of offices empty= 0
Would you like to make any changes to floor 1: Yes
what would you like to do:
Add a office: -Add
Remove an office: -Remove
Change an office: -Change
Details: -Details
Your input: - Add
I am afraid we canniot do that the floor is full!
Your input: - Details
---------------------
These are the details about floor 1:
Number of offices that are occupied are 2
office 1- Orthodontist
Best Orthodontist on the market!!!
Monthly fee : 2000
Date of the next payment: 12/01/2021
office 2- Taco Bell
Tacos
Monthly fee : 4200
Date of the next payment: 01/01/2021
------------------------------------
Any other changes [-building, -floor[floornumber], -exit]:
-floor1
------------------------------------------------------------------
This is the outline of floor 1:
Number of offices occupied= 2
Number of offices empty= 0
Would you like to make any changes to floor 1: Yes
what would you like to do:
Add a office: -Add
Remove an office: -Remove
Change an office: -Change
Details: -Details
Your input: -Change
-------------------
To which office would you like to make changes to 1 for
Orthodontist,2 for Taco bell: 1
write [keep] to keep the original details...
Enter a monthly fee: 2500
What is the name of the office: Orthodontist!!!
Description of the office: keep
Set the first date of payment (dd/mm/yyyy): keep
------------------------------------------------
Any other changes [-building, -floor[floornumber], -exit]:
-floor1
------------------------------------------------------------------
This is the outline of floor 1:
Number of offices occupied= 2
Number of offices empty= 0
Would you like to make any changes to floor 1: Yes
what would you like to do:
Add a office: -Add
Remove an office: -Remove
Change an office: -Change
Details: -Details
Your input: -Details
--------------------
These are the details about floor 1:
Number of offices that are occupied are 2
office 1- Orthodontist!!!
Best Orthodontist on the market!!!
Monthly fee : 2500
Date of the next payment: 12/01/2021
office 2- Taco Bell
Tacos
Monthly fee : 4200
Date of the next payment: 01/01/2021
------------------------------------
Any other changes [-building, -floor[floornumber], -exit]:
-exit
----------------------------------------------------------------
#include<iostream>
#include<string>
using namespace std;
// Building class
class Building
{
int no_of_floor;
int no_of_offices;
//structure to store data from each office on each
floor
struct Office
{
//these are the veraibles used to
store related data for office or floor..
int floor_no;//store floor
number
double monthly_fee;//monthly
fee
string Office_Name;
string Description;
string Payment_Date;
int day, month, year;
int count_office;
Office *next;//to store address of
next office or node by created linked list
Office *back;//to get prevoiuse
node
};
Office *Head;//head will be used to store the address
of first node or office
public:
//Constructor
Building(int floors, int offices)//get total floors,
and offices on each floor of building
{
this->no_of_floor =
floors;
this->no_of_offices =
offices;
Head=NULL;
}
//funtion to add office
void Add_Office()
{
int count_floor = 1;
int count_office = 1;
int available_floor=0;
int available_office=0;
string choice;
int check_first = 0;
while
(count_floor<=no_of_floor)
{
available_office
= no_of_offices;
while
(available_office>0)
{
again:
cout << "\nFloor: " <<
count_floor;
cout << "\nWould You like to occupy an
office on floor: " << count_floor << "(number of
offices available: " << available_office << ") ";
cout<<"\nEnter Yes or No: ";
cin >> choice;
if (choice == "YES" || choice == "yes" || choice
== "Yes")
{
//by creating structure
object we will access every attribute and store the data of each
office
Office *node = new
Office();
node->floor_no =
count_floor;
node->count_office++;
cout << "\nEnter a
monthly fee: ";
cin>>node->monthly_fee;
cout << "\nWhat is the
name of the office: ";
cin >>
node->Office_Name;
cout << "\nDescription
of the office: ";
cin.ignore();
getline(cin,
node->Description);
if (check_first == 0)
{
check_first++;
cout
<< "\nSet the first date of payment (dd/mm/yyyy)\nEnter Day:
";
cin
>> node->day;
cout<<"\nEnter Month: ";
cin>> node->month;
cout<<"\nEnter Year: ";
cin
>> node->year;
}
else
{
cout
<< "\nSet the first date of payment
(dd/mm/"<<node->year<<") \nEnter Day: ";
cin >> node->day;
cout<<"\nEnter Month: ";
cin>> node->month;
cout<<"\nEnter Year: ";
cin
>> node->year;
}
while (node->day > 31
|| node->month > 12)
{
cout
<< "\nInvalid date!";
cout
<< "\nRe-type the date(dd/mm/yyyy) \nEnter Day: ";
cin
>> node->day;
cout<<"\nEnter Month: ";
cin>> node->month;
cout<<"\nEnter Year: ";
cin
>> node->year;
}
node->next = NULL;
node->back = NULL;
if (Head == NULL)
Head =
node;
else
{
Office
*temp = Head;
while
(temp->next != NULL)
{
temp = temp->next;
}
temp->next = node;
node->back = temp;
}
available_office--;
cout << "\nWould You
like to occupy another office on floor: " <<
count_floor<<"(number of offices available :
"<<available_office<<") : ";
cin >> choice;
if (choice == "no" || choice
== "NO" || choice == "No")
break;
}
else if(choice=="no" || choice=="NO" ||
choice=="No")
break;
else
{
cout<<"\nInvalid Input!";
goto again;
}
}
count_floor++;
cout <<
"\nMoving onto floor: " << count_floor << "!!";
}
Edit_Building();
}
//funtion to give access to user to edit or access
offices on each floor
void Edit_Building()
{
int first = 0;
string choice,choice1;
int i = 1;
Office *node = Head;
cout << "\nCongrats!! you
have completed the interface of the building!!";
cout << "\nUse the following
commands to make changes to the interface of the building: ";
cout << "\nbuilding outline:-
building";
cout << "\nfloor access:-
floor[floornumber]";
cout << "exit program:-
exit";
cout << "\nGo ahead Make
changes!: ";
menue:
if (first != 0)
cout <<
"\nAny other changes [-building, -floor[floornumber], -exit]:-
";
cin >> choice1;
first++;
if (choice1 == "Building" ||
choice1 == "BUILDING" || choice1 == "building")
{
cout <<
"\nBuilding Outline";
while
(node!=NULL)
{
if (node->count_office == 1)
cout <<
node->count_office << " office occupied on floor "
<< node->floor_no << " : " <<
node->Office_Name;
else if (node->count_office == 0)
cout << "No office
occupied on floor " << node->floor_no << " :";
else
{
Office *temp = Head;
cout <<
node->count_office << " office occupied on floor "
<< node->floor_no << " : ";
while (temp != NULL)
{
if
(temp->floor_no == node->floor_no)
cout << temp->Office_Name;
temp =
temp->next;
}
}
node = node->next;
}
goto
menue;
}
else if (choice1 == "floor" ||
choice1 == "Floor" || choice1 == "FLOOR")
{
int no;
cout <<
"\nEnter Number of Floor: ";
cin >>
no;
if (no >
no_of_floor)
cout << "\nFloor Not Exist!";
else
{
Office *node = Head;
cout << "\nThis is the outline of floor "
<< no;
while (node != NULL)
{
if (node->floor_no ==
no)
{
cout
<< "\nNumber of offices occupied= " <<
node->count_office;
cout
<< "\nNumber of offices empty= " << no_of_offices -
node->count_office;
cout
<< "\nWould you like to make any changes to floor " <<
node->floor_no << ": ";
cin
>> choice;
if (choice
== "Yes" || choice == "yes" || choice == "YES")
{
cout << "\nwhat would you like to do:
";
cout << "\nAdd a office:- Add";
cout << "\nRemove an office:-
Remove";
cout << "\nDetails:- Details";
cout << "\nYour input:- ";
cin >> choice;
if (choice == "Add" || choice == "add")
{
if (node->count_office
< no_of_offices)
{
Office
*office = new Office();
office->floor_no = node->floor_no;
office->count_office++;
cout
<< "\nEnter a monthly fee: ";
cin
>> office->monthly_fee;
cout
<< "\nWhat is the name of the office: ";
cin
>> office->Office_Name;
cout
<< "\nDescription of the office: ";
getline(cin, office->Description);
cout
<< "\nSet the first date of payment (dd/mm/" <<
office->year << ") ";
cout<<"\nEnter Day: ";
cin >> node->day;
cout<<"\nEnter Month: ";
cin>> node->month;
cout<<"\nEnter Year: ";
cin
>> node->year;
while
(office->day > 31 || office->month > 12)
{
cout << "\nInvalid date!";
cout << "\nRe-type the date(dd/mm/yyyy)
";
cout<<"\nEnter Day: ";
cin >> node->day;
cout<<"\nEnter Month: ";
cin>> node->month;
cout<<"\nEnter Year: ";
cin
>> node->year;
}
office->next = NULL;
office->back = NULL;
if (Head
== NULL)
Head = node;
else
{
Office *temp = Head;
while (temp->next != NULL)
{
temp = temp->next;
}
temp->next = office;
office->back = temp;
}
}
else
cout
<< "\nNo Available Space for Another Office!";
}
else if (choice == "Remove" || choice ==
"remove")
{
int found = 0;
Office *node = Head;
int no;
cout << "\nEnter Floor
Number: ";
cin >> no;
while (node != NULL)
{
if
(node->floor_no == no)
{
if (node->next == NULL)
{
delete node;
node = NULL;
}
else
{
node->back->next =
node->next;
delete node;
node = NULL;
}
found++;
break;
}
}
if (found != 0)
cout
<< "\nFloor " << node->floor_no << " is
Deleted!";
else
cout
<< "\nFloor not Found!!";
}
else if (choice == "Details" || choice ==
"details")
{
int found = 0;
Office *node = Head;
int no;
cout << "\nEnter Floor
Number: ";
cin >> no;
cout << "\nThese are
the details about floor " << no << ":";
while (node != NULL)
{
if
(node->floor_no == no)
{
int count = 1;
cout << "\nNumber of offices that are
occupied are " << node->count_office;
Office *temp = Head;
while (temp->next != NULL)
{
if (temp->floor_no ==
node->floor_no)
{
cout
<< "office " << count << "- " <<
temp->Office_Name << "!!!" << endl;
cout
<< temp->Description << endl;
cout
<< temp->monthly_fee << endl;
cout
<< "Date of the next payment: " << temp->day
<< "/" << temp->month << "/" <<
temp->year;
count++;
}
temp = temp->next;
}
}
node =
node->next;
}
}
else
{
cout << "\nInvalid
Input!";
}
}
}
node = node->next;
}
}
goto
menue;
}
else if (choice1 == "Exit" ||
choice == "exit" || choice == "EXIT")
return;
else
{
cout <<
"\nUnknown Command Please Type a valid Command: ";
goto
menue;
}
}
};
int main()
{
int no_of_floor;//veriable to store no of floors
int no_of_offices;//to store number of offices
cout << "\nHi welcome to the work
Environment!!";
cout << "\nEnter the number of floors in the
building: ";
cin >> no_of_floor;//get no of floors from
user
cout << "\nEnter the number of offices per floor
: ";
cin >> no_of_offices;//get no of offices
Building object(no_of_floor, no_of_offices);//creat object of class Building to access funtions
object.Add_Office();//call Add_Office funtion from Building Class
return 0;
}



PLEASE GIVE A THUMBS UP!!! DONT GIVE A THUMBS DOWN IF YOU HAVE ANY QUERY SO COMMENT DOWN I WILL CLEAR IT FOR YOU.
Code in C++, use classes and comment on the code, please Scenario The users will be...
please write program in java and comment the code clearly. I am providing previous classes Media and payment codes to be used for this class.(its not a big code to write , it seems ,because i added previous classes , pleases help. public class Media { String name; int year; // a constructor which initializes the media with the provided name and publication year. public Media(String name, int year) { this.name = name; this.year = year; } //...
Please help with this C++ code. If possible comment the code and please send screenshots of the code. This assignment involves creating a program to track employee information. Keep the following information on an employee: Employee ID (string) Last name (string) First Name (string) Birth date (string as MM/DD/YYYY) Gender (M or F, single character) Start date (string as MM/DD/YYYY) Salary per year (double) Thus you must create a class that has all of this, and get/set methods for each...
c++ and please add tables and everything and make sure program
is complete.
Write a menu driven program, which would compute compound interest and a monthly payment for a loan. The user will be given a choice to display the info on the screen or to a filo Menu will be the following Enter (1) to calculate your loan monthly payment Enter (2) to calculate your loan monthly payment & write to a file Tips: Compound Interest Formula A =...
C Programming
Please read the sample runs carefully as this is quite different from the previous projects. In this project, the student can take as many courses as permitted. The list of courses to take are listed below. This time there is no restriction on the total credit hours Your code should allow the user, after you enter the student' s id, to do the following options: 1- Add a course for the student 2- Drop a course for the...
Draw an ER Model based on the following information. Please include all relationships, associations, etc.. A small local accounting company would like to create a simplified accounting management system (SAMS). SAMS will keep track of only items that are related to the calculation of income for the office. SAMS, however, will not include other office-related activities such as employee payrolls, purchasing office supplies, office expenses such as travel cost, entertainment or other complex tax-related matters. In the office, there are...
VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE
TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE
ASSIGNMENT!
. . Your program assignment Write a program name DeskGUI that computes the price of a desk and whose button Click Event calls the following methods: • A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to the SelectDesk_Click event. A method...
VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE
TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE
ASSIGNMENT!
. . Your program assignment Write a program name DeskGUI that computes the price of a desk and whose button Click Event calls the following methods: • A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to the SelectDesk_Click event. A method...
Enormous Berhad bought a building situated on a piece of leasehold land located at a prime location. The advertised price of the property is RM2.5 million, of which RM800,000 is in respect of the building while the balance is for the leasehold land. After a series of negotiation, the seller agreed to reduce the price of the leasehold land by 10%. In addition, the company paid legal fee of RM36,000, of which 40% is for the leasehold land. The land...
The homework assignment is to write a fee invoice using C. It
must follow the guidelines posted in the question and run as the
sample run given. Here is the question and sample run below
Please read the sample runs carefully as this is quite different
from the previous projects. In this project, the student can take
as many courses as permitted. The list of courses to take are
listed below. This time there is no restriction on the total...
please write this program in C++(Linux). Also write all the
explanation of codes, the comment for your code.
Description You are an avid reader and have decided that you would like to keep track of the books that you read. You will define a structure called book_list that will hold 1. a number associated with each book (int) 2. book title (string), 3. author (string), 4. a description of the book (string), 5. a date when the book was read...