Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make 10 Condition Coverage Test Cases ( White Box Testing ) with outputs from the following C++ Source Code :- #include #include #include #define max

Make 10 Condition Coverage Test Cases ( White Box Testing ) with outputs from the following C++ Source Code :-

#include #include #include

#define max 100 using namespace std;

//Class Customer class Customer { public: char name[100]; char address[100]; char phone[12]; char from_date[20]; char to_date[20]; float payment_advance; int booking_id; };

class Room { public: char type; char stype; char ac; int roomNumber; int rent; int status;

class Customer cust; class Room addRoom(int); void searchRoom(int); void deleteRoom(int); void displayRoom(Room); };

//Global Declarations class Room rooms[max]; int count=0;

Room Room::addRoom(int rno) { class Room room; room.roomNumber=rno; cout<<" Type AC/Non-AC (A/N) : "; cin>>room.ac; cout<<" Type Comfort (S/N) : "; cin>>room.type; cout<<" Type Size (B/S) : "; cin>>room.stype; cout<<" Daily Rent : "; cin>>room.rent; room.status=0;

cout<<" Room Added Successfully!"; getch(); return room; }

void Room::searchRoom(int rno) { int i,found=0; for(i=0;i

void Room::displayRoom(Room tempRoom) { cout<<" Room Number: \t"<

//hotel management class class HotelMgnt:protected Room { public: void checkIn(); void getAvailRoom(); void searchCustomer(char *); void checkOut(int); void guestSummaryReport(); };

void HotelMgnt::guestSummaryReport(){

if(count==0){ cout<<" No Guest in Hotel !!"; } for(int i=0;i

getch(); }

//hotel management reservation of room void HotelMgnt::checkIn() { int i,found=0,rno;

class Room room; cout<<" Enter Room number : "; cin>>rno; for(i=0;i

cout<<" Enter booking id: "; cin>>rooms[i].cust.booking_id;

cout<<" Enter Customer Name (First Name): "; cin>>rooms[i].cust.name;

cout<<" Enter Address (only city): "; cin>>rooms[i].cust.address;

cout<<" Enter Phone: "; cin>>rooms[i].cust.phone;

cout<<" Enter From Date: "; cin>>rooms[i].cust.from_date;

cout<<" Enter to Date: "; cin>>rooms[i].cust.to_date;

cout<<" Enter Advance Payment: "; cin>>rooms[i].cust.payment_advance;

rooms[i].status=1;

cout<<" Customer Checked-in Successfully.."; getch(); } }

//hotel management shows available rooms void HotelMgnt::getAvailRoom() { int i,found=0; for(i=0;i

//hotel management shows all persons that have booked room void HotelMgnt::searchCustomer(char *pname) { int i,found=0; for(i=0;i

cout<<" Press enter for next record"; found=1; getch(); } } if(found==0) { cout<<" Person not found."; getch(); } }

//hotel managemt generates the bill of the expenses void HotelMgnt::checkOut(int roomNum) { int i,found=0,days,rno; float billAmount=0; for(i=0;i>days; billAmount=days * rooms[i].rent;

cout<<" \t######## CheckOut Details ######## "; cout<<" Customer Name : "<

rooms[i].status=0; } getch(); }

//managing rooms (adding and searching available rooms) void manageRooms() { class Room room; int opt,rno,i,flag=0; char ch; do { system("cls"); cout<<" ### Manage Rooms ###"; cout<<" 1. Add Room"; cout<<" 2. Search Room"; cout<<" 3. Back to Main Menu"; cout<<" Enter Option: "; cin>>opt;

//switch statement switch(opt) { case 1: cout<<" Enter Room Number: "; cin>>rno; i=0; for(i=0;i>rno; room.searchRoom(rno); break; case 3: //nothing to do break; default: cout<<" Please Enter correct option"; break; } }while(opt!=3); } using namespace std; int main() { class HotelMgnt hm; int i,j,opt,rno; char ch; char pname[100];

system("cls");

do { system("cls"); cout<<"######## Hotel Management ######### "; cout<<" 1. Manage Rooms"; cout<<" 2. Check-In Room"; cout<<" 3. Available Rooms"; cout<<" 4. Search Customer"; cout<<" 5. Check-Out Room"; cout<<" 6. Guest Summary Report"; cout<<" 7. Exit"; cout<<" Enter Option: "; cin>>opt; switch(opt) { case 1: manageRooms(); break; case 2: if(count==0) { cout<<" Rooms data is not available. Please add the rooms first."; getch(); } else hm.checkIn(); break; case 3: if(count==0) { cout<<" Rooms data is not available. Please add the rooms first."; getch(); } else hm.getAvailRoom(); break; case 4: if(count==0) { cout<<" Rooms are not available. Please add the rooms first."; getch(); } else { cout<<"Enter Customer Name: "; cin>>pname; hm.searchCustomer(pname); } break; case 5: if(count==0) { cout<<" Rooms are not available. Please add the rooms first."; getch(); } else { cout<<"Enter Room Number : "; cin>>rno; hm.checkOut(rno); } break; case 6: hm.guestSummaryReport(); break; case 7: cout<<" THANK YOU! FOR USING SOFTWARE"; break; default: cout<<" Please Enter correct option"; break; } }while(opt!=7);

getch(); }

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

ISBN: 1583474013, 978-1583474013

More Books

Students also viewed these Databases questions