Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Use the provided files under the Car Wash Files tab, create a program that checks in and out customers at a car wash. Specifics

C++

Use the provided files under the Car Wash Files tab, create a program that checks in and out customers at a car wash.

Specifics

Upon running the program, the user will be greeted with a menu with the following functions:

  • Check in: Checks in the customer. The user will be asked to insert the name of the customer, the license plate number, and whether or not the customer wants a premium wash.
  • Check out: Checks out the next customer. A notification stating which customer has been checked out will be displayed. Checked out customers will be stored in a history database.
  • Search: Searches the history database for a customer. The customers details will be printed.
  • Quit: Checks out the remaining customers, erases the history, and exits the program.

Use the appropriate data structures. You can use the data structures found under the Car Wash Files tab, or use the C++ STL.

Utilize the customer.h header file to create customer objects. Traits of customers include their name, license plate number, and their wash preference.

Sample programs that utilize the three data structures have been provided. You can view them under the Examples section of the Car Wash Files tab.

Sample Output

User Input is surrounded by [ ]

1) Check in 2) Check out 3) Search 4) Quit Input: [1] Name: [Oscar Olazabal] License Plate: [QWERTY1] Premium Wash? (y/n): [y] Customer checked in 1) Check in 2) Check out 3) Search 4) Quit Input: [1] Name: [Charles Bucher] License Plate: [POIU123] Premium Wash? (y/n): [y] Customer checked in 1) Check in 2) Check out 3) Search 4) Quit Input: [1] Name: [William Clemons] License Plate: [ASD12FD] Premium Wash? (y/n): [n] Customer checked in 1) Check in 2) Check out 3) Search 4) Quit Input: [1] Name: [Bill Nye] License Plate: [GHJ34LD] Premium Wash? (y/n): [n] Customer checked in 1) Check in 2) Check out 3) Search 4) Quit Input: [3] Name: [Oscar Olazabal] Customer not found. 1) Check in 2) Check out 3) Search 4) Quit Input: [2] Oscar Olazabal checked out. 1) Check in 2) Check out 3) Search 4) Quit Input: [3] Name: [Oscar Olazabal] Name: Oscar Olazabal License Plate Number: QWERTY1 Premium Wash: Yes 1) Check in 2) Check out 3) Search 4) Quit Input: [2] Charles Bucher checked out. 1) Check in 2) Check out 3) Search 4) Quit Input: [3] Name: [Charles Bucher] Name: Charles Bucher License Plate Number: POIU123 Premium Wash: Yes 1) Check in 2) Check out 3) Search 4) Quit Input: [4] Checking out William Clemons Checking out Bill Nye Exiting program... 

carwash.h

#ifndef CUSTOMER_H #define CUSTOMER_H #include  #include  using namespace std; class Customer { public: Customer(const string name = "Tuffy", const string license_plate = "1111111", bool premium_wash = false) { this->name = name; this->license_plate = license_plate; this->premium_wash = premium_wash; } ~Customer() {} void set_name(const string name) { this->name = name; } void set_license_plate(const string license_plate) { this->license_plate = license_plate; } void set_premium_wash(bool premium_wash) { this->premium_wash = premium_wash; } string get_name() const { return name; } string get_license_plate() const { return license_plate; } bool get_premium_wash() const { return premium_wash; } bool operator>(const Customer & right) const { return (name > right.name); } bool operator==(const Customer & right) const { return (name == right.name); } bool operator<(const Customer & right) const { return (name < right.name); } friend ostream & operator<<(ostream & out, const Customer customer) { out << "Name: " << customer.get_name() << endl; out << "License Plate Number: " << customer.get_license_plate() << endl; out << "Premium Wash: "; if (customer.get_premium_wash()) out << "Yes "; else out << "No "; return out; } private: string name; string license_plate; bool premium_wash; }; 

carwash.cpp

#include  #include  #include "customer.h" using namespace std; void Menu(); // Menu that displays options. void CheckIn(); // Check in a customer. void CheckOut(); // Remove customer from list. void Search(); // Search for a customer. void Quit(); // Quit program. int main() { bool loop = true; int selection; do { Menu(); cout << "Input: "; cin >> selection; cin.ignore(); switch (selection) { case 1: cout << endl; CheckIn(); cout << endl; break; case 2: cout << endl; CheckOut(); cout << endl; break; case 3: cout << endl; Search(); cout << endl; break; case 4: cout << endl; Quit(); loop = false; cout << "Exiting program... "; break; default: break; } } while (loop); } void Menu() { cout << "1) Check in "; cout << "2) Check out "; cout << "3) Search "; cout << "4) Quit "; } void CheckIn() { } void CheckOut() { } void Search() { } void Quit() { }

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

Visualizing Health And Healthcare Data Creating Clear And Compelling Visualizations To See How Youre Doing

Authors: Katherine Rowell ,Lindsay Betzendahl ,Cambria Brown

1st Edition

1119680883, 978-1119680888

Students also viewed these Databases questions

Question

g. Is the value of b equal to 0.5?

Answered: 1 week ago

Question

Address an envelope properly.

Answered: 1 week ago

Question

Discuss guidelines for ethical business communication.

Answered: 1 week ago