Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please explain the idea for each line of this code especially the entire part after private: and to the int main(). Doesn't need to be

Please explain the idea for each line of this code especially the entire part after "private:" and to the "int main()".

Doesn't need to be a long explanation just a clear short sentence should be enough.

The Code is in .cpp:

//------------------------------------------------------------- #include // Required for cout using namespace std; // Required for cout //------------------------------------------------------------- /// A simple class to encapsulate the concept of a hotel room booking //------------------------------------------------------------- // Copyright Napat Sanguandeekul // Input arguments: A sets of test data (numbers) for testing if the class and // : overall code process properly according to client demand output // : // Output : Display the Number of Customers, Rooms, Nights and the total Cost of Stay // Header file : None //------------------------------------------------------------- class roomBooking; //------------------------------------------------------------- class roomBooking { public: roomBooking(unsigned int _roomNumber, unsigned int _customerNumber, float _costPerNight, unsigned int _numberOfNights); /// 5% and for implementation below roomBooking(const roomBooking& L); /// 5% and for implementation below roomBooking& operator=(const roomBooking& L); /// 5% and for implementation below ~roomBooking(){} /// 3% and for implementation below //------------------------------------------------------------- // Note careful selection of which sets & gets to provide unsigned int get_customerNumber(){return(customerNumber);} /// All gets and sets 2% unsigned int get_numberOfNights(){return(numberOfNights);} void set_customerNumber(unsigned int _customerNumber){customerNumber=_customerNumber;} void set_numberOfNights(unsigned int _numberOfNights){numberOfNights=_numberOfNights;} float costOfStay(); void printBill(); private: /// 5% unsigned int roomNumber; unsigned int customerNumber; float costPerNight; // unsigned int numberOfNights; }; //--------------------------------------------------------------------------- roomBooking::roomBooking(unsigned int _roomNumber, unsigned int _customerNumber, float _costPerNight, unsigned int _numberOfNights) :roomNumber(_roomNumber), customerNumber(_customerNumber), costPerNight(_costPerNight), numberOfNights(_numberOfNights){} //--------------------------------------------------------------------------- roomBooking::roomBooking(const roomBooking& rB) :roomNumber(rB.roomNumber), customerNumber(rB.customerNumber), costPerNight(rB.costPerNight), numberOfNights(rB.numberOfNights){} //--------------------------------------------------------------------------- roomBooking& roomBooking::operator=(const roomBooking& rB){ if(this==&rB) return(*this); roomNumber=rB.roomNumber; customerNumber=rB.customerNumber; costPerNight=rB.costPerNight; numberOfNights=rB.numberOfNights; return(*this); } //--------------------------------------------------------------------------- float roomBooking::costOfStay(){ // As above return(costPerNight*float(numberOfNights)); } //--------------------------------------------------------------------------- void roomBooking::printBill(){ // As above cout<<" customerNumber="<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions