can someone help me fix this code so it outputs properly In order to better organize its business, the Lawrenceville Lawn Service wants to computerize its customer list. The information for each customer(name, address, size of lawn, and day of the week they wish their lawn to be mowed) should be stored in parallel arrays. Write a program that allows the user to perform the following functions: Add a new customer Remove a customer Display a table of jobs for a given day. The table should be similar to the one shown in the sample run below, showing the name, address, cost and total charge including 7% sales tax. LLS charges 2 cents per square yard for cutting. When run, the program output should look similar to: Enter Display, Add, dElete, Quit: a ADD Enter name to be added: Tiger Woods Enter address: 65 Lakeshore Drive Enter lawn size: 1262 Enter day to be cut: Saturday Enter Display, Add, dElete, Quit: a ADD Enter name to be added: Julia Winitsky Enter address: 16 Manor Dr Enter lawn size: 2500 Enter day to be cut: Tuesday Enter Display, Add, dElete, Quit: e Delete Enter name for deletion: Tiger Woods ** DELETED ** Enter Display, Add, dElete, Quit: e DELETE Enter name for deletion: Josephine Bouchard ** Error Name not on list ** Enter Display, Add, dElete, Quit: X ** Please enter D, A, E, or Q ** Enter Display, Add, dElete, Quit: d DISPLAY Enter day for list: Tuesday LAWRENCEVILLE LAWN SERVICE Schedule for: Tuesday NAME ADDRESS COST TOTAL Julia Winitsky 16 Manor Dr. $50.00 $53.50 Enter Display, Add, dElete, Quit: q QUIT ** Program complete ** code: #include #include #include using namespace std; const double COST_PER_SQ_YARD = .02; const double TAX_RATE = .07; string name[20]; string address[20]; int size[20]; string day[20]; int customerCount = 0; void displayMenu(); void addCustomer(); void deleteCustomer(); void displayListByDay(); int main() {    char userInput;    cout << "Welcome to Lawrenceville Lawn Service!" << endl;    displayMenu();    cin >> userInput;    userInput = toupper(userInput);    while (userInput != 'Q'){        switch (userInput)        {        case 'D':            displayListByDay();            break;        case 'A':            addCustomer();            break;        case 'E':            deleteCustomer();            break;        default:            cout << "Please enter D, A, E, or Q" << endl;            break;        }        displayMenu();        cin >> userInput;        userInput = toupper(userInput);    }    cout << "Program complete" << endl;    return 0; } void displayMenu() {    cout << "Enter Display, Add, dElete, Quit: "; } void addCustomer() {    string nameInput;    string addressInput;    int sizeInput;    string dayInput;    cout << "ADD" << endl;    cout << "Enter name to be added: ";    cin >> nameInput;    cout << "Enter address: ";    cin >> addressInput;    cout << "Enter lawn size: ";    cin >> sizeInput;    cout << "Enter day to be cut: ";    cin >> dayInput;    name[customerCount] = nameInput;    address[customerCount] = addressInput;    size[customerCount] = sizeInput;    day[customerCount] = dayInput;    customerCount++; } void deleteCustomer() {    string nameInput;    bool deleted = false;    cout << "DELETE" << endl;    cout << "Enter name for deletion: ";    cin >> nameInput;    for (int i = 0; i < customerCount; i++)    {        if (name[i] == nameInput)        {            for (int j = i; j < customerCount - 1; j++)            {                name[j] = name[j + 1];                address[j] = address[j + 1];                size[j] = size[j + 1];                day[j] = day[j + 1];            }            customerCount--;            deleted = true;            break;        }    }    if (deleted)        cout << "** DELETED **" << endl;    else        cout << "** Error Name not on list **" << endl; } void displayListByDay() {    string dayInput;    cout << "DISPLAY" << endl;    cout << "Enter day for list: ";    cin >> dayInput;    cout << endl;    cout << "LAWRENCEVILLE LAWN SERVICE" << endl;    cout << "Schedule for: " << dayInput << endl;    cout << endl;    cout << left << setw(20) << "NAME";    cout << left << setw(20) << "ADDRESS";    cout << left << setw(20) << "COST";    cout << left << setw(20) << "TOTAL" << endl;    for (int i = 0; i < customerCount; i++)    {        if (day[i] == dayInput)        {            cout << left << setw(20) << name[i];            cout << left << setw(20) << address[i];            cout << left << setw(20) << fixed << setprecision(2) << "$" << size[i] * COST_PER_SQ_YARD;            cout << left << setw(20) << fixed << setprecision(2) << "$" << (size[i] * COST_PER_SQ_YARD) * (1 + TAX_RATE) << endl;        }    } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

can someone help me fix this code so it outputs properly

In order to better organize its business, the Lawrenceville Lawn Service wants to computerize its customer list. The information for each customer(name, address, size of lawn, and day of the week they wish their lawn to be mowed) should be stored in parallel arrays. Write a program that allows the user to perform the following functions:

Add a new customer

Remove a customer

Display a table of jobs for a given day. The table should be similar to the one shown in the sample run below, showing the name, address, cost and total charge including 7% sales tax. LLS charges 2 cents per square yard for cutting.

When run, the program output should look similar to:

Enter Display, Add, dElete, Quit: a ADD Enter name to be added: Tiger Woods Enter address: 65 Lakeshore Drive Enter lawn size: 1262 Enter day to be cut: Saturday Enter Display, Add, dElete, Quit: a ADD Enter name to be added: Julia Winitsky Enter address: 16 Manor Dr Enter lawn size: 2500 Enter day to be cut: Tuesday Enter Display, Add, dElete, Quit: e Delete Enter name for deletion: Tiger Woods ** DELETED ** Enter Display, Add, dElete, Quit: e DELETE Enter name for deletion: Josephine Bouchard ** Error Name not on list ** Enter Display, Add, dElete, Quit: X ** Please enter D, A, E, or Q ** Enter Display, Add, dElete, Quit: d DISPLAY Enter day for list: Tuesday LAWRENCEVILLE LAWN SERVICE Schedule for: Tuesday NAME ADDRESS COST TOTAL Julia Winitsky 16 Manor Dr. $50.00 $53.50 Enter Display, Add, dElete, Quit: q QUIT ** Program complete **

code:

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

const double COST_PER_SQ_YARD = .02;
const double TAX_RATE = .07;

string name[20];
string address[20];
int size[20];
string day[20];

int customerCount = 0;

void displayMenu();
void addCustomer();
void deleteCustomer();
void displayListByDay();

int main()
{
   char userInput;

   cout << "Welcome to Lawrenceville Lawn Service!" << endl;
   displayMenu();
   cin >> userInput;
   userInput = toupper(userInput);

   while (userInput != 'Q'){
       switch (userInput)
       {
       case 'D':
           displayListByDay();
           break;
       case 'A':
           addCustomer();
           break;
       case 'E':
           deleteCustomer();
           break;
       default:
           cout << "Please enter D, A, E, or Q" << endl;
           break;
       }
       displayMenu();
       cin >> userInput;
       userInput = toupper(userInput);
   }

   cout << "Program complete" << endl;

   return 0;
}

void displayMenu()
{
   cout << "Enter Display, Add, dElete, Quit: ";
}

void addCustomer()
{
   string nameInput;
   string addressInput;
   int sizeInput;
   string dayInput;

   cout << "ADD" << endl;
   cout << "Enter name to be added: ";
   cin >> nameInput;
   cout << "Enter address: ";
   cin >> addressInput;
   cout << "Enter lawn size: ";
   cin >> sizeInput;
   cout << "Enter day to be cut: ";
   cin >> dayInput;

   name[customerCount] = nameInput;
   address[customerCount] = addressInput;
   size[customerCount] = sizeInput;
   day[customerCount] = dayInput;
   customerCount++;
}

void deleteCustomer()
{
   string nameInput;
   bool deleted = false;

   cout << "DELETE" << endl;
   cout << "Enter name for deletion: ";
   cin >> nameInput;

   for (int i = 0; i < customerCount; i++)
   {
       if (name[i] == nameInput)
       {
           for (int j = i; j < customerCount - 1; j++)
           {
               name[j] = name[j + 1];
               address[j] = address[j + 1];
               size[j] = size[j + 1];
               day[j] = day[j + 1];
           }
           customerCount--;
           deleted = true;
           break;
       }
   }

   if (deleted)
       cout << "** DELETED **" << endl;
   else
       cout << "** Error Name not on list **" << endl;
}

void displayListByDay()
{
   string dayInput;

   cout << "DISPLAY" << endl;
   cout << "Enter day for list: ";
   cin >> dayInput;

   cout << endl;
   cout << "LAWRENCEVILLE LAWN SERVICE" << endl;
   cout << "Schedule for: " << dayInput << endl;
   cout << endl;
   cout << left << setw(20) << "NAME";
   cout << left << setw(20) << "ADDRESS";
   cout << left << setw(20) << "COST";
   cout << left << setw(20) << "TOTAL" << endl;

   for (int i = 0; i < customerCount; i++)
   {
       if (day[i] == dayInput)
       {
           cout << left << setw(20) << name[i];
           cout << left << setw(20) << address[i];
           cout << left << setw(20) << fixed << setprecision(2) << "$" << size[i] * COST_PER_SQ_YARD;
           cout << left << setw(20) << fixed << setprecision(2) << "$" << (size[i] * COST_PER_SQ_YARD) * (1 + TAX_RATE) << endl;
       }
   }
}

 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education