
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
Write a C++ program to add new details in the existing ArrayList and to remove details from the ArrayList. Use Menu to add, remove and display the Hall details.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names and function names should be the same as specified in the problem statement.
Create Hall class with private member variables
Data type | Variables |
string | name |
int | contactNumber |
double | costPerDay |
string | ownerName |
Include appropriate getters, and setters and constructor (name,contactNumber,costPerDay,ownerName) in this order for the Hall class.
Include following public member function in Hall class
Method Name | Description |
list<Hall> getHallDetails() | This method is used to return the hall details. [Hall details are already pre-populated in the template code] |
Create HallBO class and include following member function
Method Name | Description |
bool contains(list <Hall> halls, string hallName ) | This function is used to compare whether the hall list contains that hall name. If the hall name presents it returns true to remove that name otherwise it returns false. |
void display(list<Hall> halls) | This function is used to display the list of halls along with hardcoded details. Use "%-25s%-25d%-25.2f%-25s\n" to print table the details. |
In the main method test the above class and print the string "Hall Details:" in the main method itself
Input and Output format:
Print the costPerDay with two decimal values.
[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output 1:
Sample Input and Output 1:
1.Add
2.Remove
3.Display
Enter your choice
3
Hall Details:
Hall Name Contact Number Cost Owner
Chiltington 1798888137 30000.00 Robert
Kilmersdon 1761436767 22000.00 James
Press 1 to continue
2
Sample Input and Output 2:
1.Add
1.Add
2.Remove
3.Display
Enter your choice
1
Enter the details of Hall
Hall Name :
Mahal
Contact Number :
1761436007
Cost per day :
22000
Owner Name :
Akshay
Press 1 to continue
1
1.Add
2.Remove
3.Display
Enter your choice
1
Enter the details of Hall
Hall Name :
Manor
Contact Number :
1515232061
Cost per day :
25000
Owner Name :
Jack
Press 1 to continue
1
1.Add
2.Remove
3.Display
Enter your choice
3
Hall Details:
Hall Details:
Hall Name Contact Number Cost Owner
Mahal 1761436007 22000.00 Akshay
Manor 1515232061 25000.00 Jack
Chiltington 1798888137 30000.00 Robert
Kilmersdon 1761436767 22000.00 James
Press 1 to continue
1
1.Add
2.Remove
3.Display
Enter your choice
2
Enter the Hall name to be removed
Kilmersdon
Press 1 to continue
1
1.Add
2.Remove
3.Display
Enter your choice
3
Hall Details:
Hall Details:
Hall Name Contact Number Cost Owner
Mahal 1761436007 22000.00 Akshay
Manor 1515232061 25000.00 Jack
Chiltington 1798888137 30000.00 Robert
Press 1 to continue
2
--------Strictly Use Below Template While Making Solution-------------
main.cpp
#include <iostream> #include <stdio.h> #include<list> //#include "Hall.cpp" #include "HallBO.cpp" using namespace std; int main(){ int n, choice, p; string name, ownerName, hallName; int contactNumber; double costPerDay; static list<Hall> hallList; list<Hall>::iterator it; Hall h3; HallBO hbo; hallList = h3.getHallDetails(); do{ cout<<"1.Add\n"; cout<<"2.Remove\n"; cout<<"3.Display\n"; cout<<"Enter your choice\n"; cin>>choice; //fill the code }while(p==1); } |
HallBo.cpp
#include<iostream> #include "Hall.cpp" #include<list> using namespace std; class HallBO{ public: Hall h; bool contains(list <Hall> halls, string hallName){ //fill the code } void display(list<Hall> halls){ //fill the code } }; |
Hall.cpp
#include <iostream> #include <stdio.h> #include<list> using namespace std; class Hall{ private: string name; int contactNumber; double costPerDay; string ownerName; public: Hall(){ } Hall(string name, int contactNumber, double costPerDay, string ownerName){ this->name = name; this->contactNumber = contactNumber; this->costPerDay = costPerDay; this->ownerName = ownerName; } list<Hall> getHallDetails(){ list<Hall> hallList; hallList.push_back(Hall("Chiltington",1798888137,30000,"Robert")); hallList.push_back(Hall("Kilmersdon",1761436767,22000,"James")); return hallList; } void setName(string name){ this->name=name; } string getName(){ return this->name; } void setContactNumber(int contactNumber){ this->contactNumber=contactNumber; } int getContactNumber(){ return this->contactNumber; } void setCostPerDay(double costPerDay){ this->costPerDay=costPerDay; } double getCostPerDay(){ return this->costPerDay; } void setOwnerName(string ownerName){ this->ownerName=ownerName; } string getOwnerName(){ return this->ownerName; } }; |
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 3 images

Knowledge Booster
Similar questions
- please create any c++ game, but you must include these features: First, create a comment section at the top of your code in the main cpp file which lists the location of each of these features in your code. If they are not listed in this top comment section Multilevel Inheritance with polymorphism and includes at least one abstract class. Dynamic memory (new, delete) using pointers within a class. At least one template class. At least one operator overloading. Use .h and .cpp files for classes. Example of Comment section at top of code in Main: Features of this program: Multilevel inheritance is shown in the three classes: Vehicle, Car, Corvette. Polymorphism is executed through the display_car() function found in the classes Car and Corvette, with the virtual display_car() in the superclass Vehicle. The Car class is abstract with the function, car_color() = 0. Dynamic memory... The ______ class is a template... Operator overloading occurs with this class...arrow_forwardNote:C++ programming Create a class: “Palindrome” with private data members: upper_limit (int), lower_limit (int) and parameterized constructor, which initializes the values of both data members. Apart from initialization, this constructor also displays the count of palindrome numbers from upper_limit to lower_limit. [Example: upper_limit:50, lower_limit:10, count of palindrome numbers is:4(11 , 22, 33 and 44), also make sure the value of upper_limit should be greater than lower_limit].arrow_forwardUsing C++ programming language make a class Cone having radius and height as class members. Use parameterized constructor to initialize the radius and height of Cone. Use one member function display to print the area of total surface of cone.arrow_forward
- C++arrow_forwardWRITE IN C++ A Date class is described by month(m), day(d), year(y). An Employee is described by a unique data structure having a name (e.g. “George”), salary(75000.25) and date_of_birth (06, 10, 1998). Calculate the number of days between his day of birth and (09, 20, 2023). Assume that the Employee object contains a Date sub-object)arrow_forwardThe code is in C++arrow_forward
- Programming Demo 3: Dog Class Write the program below to familiarize with the conventional syntax and formatting of Object-Oriented Programming in Python. 1. Let us create a class Dog with the script below. Save this script as dogs.py. Take note of the indentions, colons, and number of parenthesis used to avoid errors on our program. 12345678 3 9 10 11 12 class Dog: definit_(self, name, breed, age): self.name = name self.breed breed = self.age = age def sit(self): print (self.name.title() + is now sitting.") 123456 def roll(self): " print (self.name.title() + rolled over!") def bark(self, times): print (self.name, 'says woof', times, times.') 2. Identify the user-defined attributes/parameters on our class Dog. " 3. Identify the user-defined methods or actions that can be acted out on our class Dog. 4. Create a new Python script and name it as sub_dogs.py. Make sure this script is saved on the same folder with dogs.py. Write the codes below then run it. from dogs import Dog dog1=…arrow_forwardWritten in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forwardIn C++ write the definition of the class professorType, inherited from the class personType, defined in Chapter 10, with an additional data member to store a professor’s highest degree. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Write a test program to initialize, access, and manipulate the data members. For example, the mathProfessor holds a Doctorate degree.arrow_forward
- When defining an array of a classtype, a C++ programmer has no way to specify which overloaded constructor is used on each declared array element, as the default no-argument constructor will always be used no matter what. True O Falsearrow_forwardC++ PROGRAM Create a class 3D point to model points in 3-dimensional space. Provide appropriate constructors and get/set methods in the class. Using friend functions, overload the following operators. + operator to add two 3D points. - operator to subtract two 3D points. ~ operator to find the distance between two points.arrow_forwardUsing C++ and Visual Studios Using your own creativity, make a set of class templates that have these features: For this class template, put everything in one place--do not declare the member functions and have separate definition of the member functions elsewhere. Keep them in one place. Include a private variable. Include a constructor that loads the private variable when constructed. Include a destructor that clears the private variable to zero. Include set and get functions to set and get the private variable.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education