can't fit this whole code, but I need help in making the functions DeleteClient, PrintAllClients, ReadOneClient, FindAClient, FindAndPrintPetInfo Instructions: In this C++ program, you are to implement a program that will manage a "database" of clients for a Pet Stylist. However, this is the stylist's side job, so the maximum number of clients will be fixed at 20 and each client can have at most 7 pets. The "database" is just a text file named client_database.dat. A sample database file has been included in your files. The program should first ask what the user wants to do from the following menu: Print out a bill for the client Print out the information on a pet for a client Add a client Delete a client Print the entire database of clients Quit and write out (update) the "database" The program should continue to ask what the user wants to do until the user selects option 6 (enters the number 6). Reminder: The maximum number of clients is 20 The maximum number of pets for a client is 7 Program Requirements: Use global constants to store the maximum client and pet array sizes There should be 2 struct's declared in your program: Pet and Client Pet -- contains the following data members strings for species, breed, and name of the pet a character for gender of the pet an integer for age of the pet Client -- contains the following data members an integer for the client_id -- the client's id/account number a string for name of the client and a string for the address of the client a floating point for account_balance that will contain the account balance for the client an integer number_of_pets for how many pets the client has Pet pet_list[kMaxPets] -- an array of Pet struct's to hold the pet information for each pet of the client implement the following functions, descriptions for what each function does are available in your main.cpp file as comments. void GetAllClients(Client clients[], int & count, int & next_client_id); Client ReadOneClient(std::ifstream &); int FindAClient(const Client clients[], int count, int client_id); void PrintBill(const Client clients[], int client_id, int count); void FindAndPrintPetInfo(const Client clients[], int client_id, int count); void AddNewClient(Client clients[], int & count, int & next_client_id); void DeleteClient(Client clients[], int client_id, int &count); void PrintAllClients(const Client clients[], int count); void SaveDatabase(const Client clients[],int count, int next_client_id);

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

I can't fit this whole code, but I need help in making the functions DeleteClient, PrintAllClients, ReadOneClient, FindAClient, FindAndPrintPetInfo

Instructions:

In this C++ program, you are to implement a program that will manage a "database" of clients for a Pet Stylist. However, this is the stylist's side job, so the maximum number of clients will be fixed at 20 and each client can have at most 7 pets. The "database" is just a text file named client_database.dat. A sample database file has been included in your files.

The program should first ask what the user wants to do from the following menu:

  1. Print out a bill for the client
  2. Print out the information on a pet for a client
  3. Add a client
  4. Delete a client
  5. Print the entire database of clients
  6. Quit and write out (update) the "database"

The program should continue to ask what the user wants to do until the user selects option 6 (enters the number 6).

Reminder:

  • The maximum number of clients is 20
  • The maximum number of pets for a client is 7

Program Requirements:

  • Use global constants to store the maximum client and pet array sizes

  • There should be 2 struct's declared in your program: Pet and Client

    1. Pet -- contains the following data members
      • strings for species, breed, and name of the pet
      • character for gender of the pet
      • an integer for age of the pet
    2. Client -- contains the following data members
      • an integer for the client_id -- the client's id/account number
      • string for name of the client and a string for the address of the client
      • floating point for account_balance that will contain the account balance for the client
      • an integer number_of_pets for how many pets the client has
      • Pet pet_list[kMaxPets] -- an array of Pet struct's to hold the pet information for each pet of the client
  • implement the following functions, descriptions for what each function does are available in your main.cpp file as comments.

    • void GetAllClients(Client clients[], int & count, int & next_client_id);
    • Client ReadOneClient(std::ifstream &);
    • int FindAClient(const Client clients[], int count, int client_id);
    • void PrintBill(const Client clients[], int client_id, int count);
    • void FindAndPrintPetInfo(const Client clients[], int client_id, int count);
    • void AddNewClient(Client clients[], int & count, int & next_client_id);
    • void DeleteClient(Client clients[], int client_id, int &count);
    • void PrintAllClients(const Client clients[], int count);
    • void SaveDatabase(const Client clients[],int count, int next_client_id);
 
Additions
  • GetAllClients() should open the database, read from it, and close the file. It will repeatedly use ReadOneClient() to read one client's information from the database to store.
  • SaveDatabase() should re-open the file to replace the old information by writing all current information, and closing the file.
  • FindAClient() performs a simple linear search to try to find the client in the array
  • No pointers
1 What would you like to do?
2 1. Print out a bill for a client
3
4 3.
2. Print out the information on a pet for a client
Add a client
34.
65.
Delete a client
Print the database of clients
7 5. Quit and write out the database
85
9 Client list:
10 Samantha Pelham
11 5884768
12 8222 North Platte Dr., Franklin, TN, 37064
13 456.75
14 Pets:
15
10
17
18
19 Arthur Warwick
20 3004701
21 1827 West Main, Franklin, TN 37827
22 8
23
24
Biscuit dog golden retriever 4
Mittens cat ragamuffin f 2
Pets:
Godzilla dog labrador = 1
26
27 David Johnson
28 3004782
29 12 Rolling Hills Ct., Apt. 4, Franklin, TN 37827
30 125
33
34
31 Pets:
32
DeeDee cat persian 3
Minette cat british shorthair f 3
Scarlet dog poodle f 2
30
37 Tammy Donnavan
38 3004783
39 1832 East Westside Street, Arrington, TN 37814
41 Pets:
Sneaky dog german shepherd f
44 What would you like to do?
1. Print out a bill for a client
2. Print out the information on a pet for a client
3.
Add a client
48 4. Delete a client
49 5. Print the database of clients
6.
Quit and write out the database
31 1
52 What is the client's ID 3884780
33 B111 for Samantha Pethan
34 Total owed is 456.75
53
36 What would you like to do?
57 1. Print out a bill for a client
58 2. Print out the information on a pet for a client
39
3. Add a client
00
4. Delete a client
5. Print the database of clients
6. Quit and write out the database
62
03 2
64 What is the client's ID 3884782
63 Please input the pet name Scarlett
00
67 The pet isn't in the database
08
09 What would you like to do?
70 1. Print out a bill for a client
71
72 3. Add a client
2. Print out the information on a pet for a client
73
4. Delete a client
74 5. Print the database of
75 6. Quit and write out the database
76 2
77 What is the client's ID 3884782
78
Please input the pet name Scarlet
79
88
81 Specles: dog
82 Breed:
Information for Scarlet
poodle
83 Gender: f
84 Age:
2
Transcribed Image Text:1 What would you like to do? 2 1. Print out a bill for a client 3 4 3. 2. Print out the information on a pet for a client Add a client 34. 65. Delete a client Print the database of clients 7 5. Quit and write out the database 85 9 Client list: 10 Samantha Pelham 11 5884768 12 8222 North Platte Dr., Franklin, TN, 37064 13 456.75 14 Pets: 15 10 17 18 19 Arthur Warwick 20 3004701 21 1827 West Main, Franklin, TN 37827 22 8 23 24 Biscuit dog golden retriever 4 Mittens cat ragamuffin f 2 Pets: Godzilla dog labrador = 1 26 27 David Johnson 28 3004782 29 12 Rolling Hills Ct., Apt. 4, Franklin, TN 37827 30 125 33 34 31 Pets: 32 DeeDee cat persian 3 Minette cat british shorthair f 3 Scarlet dog poodle f 2 30 37 Tammy Donnavan 38 3004783 39 1832 East Westside Street, Arrington, TN 37814 41 Pets: Sneaky dog german shepherd f 44 What would you like to do? 1. Print out a bill for a client 2. Print out the information on a pet for a client 3. Add a client 48 4. Delete a client 49 5. Print the database of clients 6. Quit and write out the database 31 1 52 What is the client's ID 3884780 33 B111 for Samantha Pethan 34 Total owed is 456.75 53 36 What would you like to do? 57 1. Print out a bill for a client 58 2. Print out the information on a pet for a client 39 3. Add a client 00 4. Delete a client 5. Print the database of clients 6. Quit and write out the database 62 03 2 64 What is the client's ID 3884782 63 Please input the pet name Scarlett 00 67 The pet isn't in the database 08 09 What would you like to do? 70 1. Print out a bill for a client 71 72 3. Add a client 2. Print out the information on a pet for a client 73 4. Delete a client 74 5. Print the database of 75 6. Quit and write out the database 76 2 77 What is the client's ID 3884782 78 Please input the pet name Scarlet 79 88 81 Specles: dog 82 Breed: Information for Scarlet poodle 83 Gender: f 84 Age: 2
#include <iostream>
#include <fstream>
3
// Define global constants for the maximum number of clients and pets here
4 const int MAX NUM - 28;
3 const int KMAXPETS - 7;
6 const std::string Filename="SampleRund.txt";
7
8 // Define the struct for Pet here
9- struct Pet
10
11
12
13
14
15 };
COLORE岛同志网险应限内需易联网高安国际限内S
10
18
17 // define the struct for Client here
19
27
20 std::string name;
std::string address;
21
22 float account balance;
23 int number of pets;
24
23 };
28 // Function Prototypes
40
29 vold GetAllClients(Client clients[], int & count, int & next_client_id);
38 vold PrintAllClients(const client clients[], int count);
31 vold SaveDatabase(const Client clients[], int count, int next_client_id];
32
57
58
39
33 Client ReadOneClient(std::lfstream 5);
34 int FindACLlent (const client clients[], int count, int client_id);
33 vold PrintB111(const Client clients[], int count, int client_td);
30
S5223885882EFRRRRRRS2328.82R====2258
37 vold FindAndPrintPetInfo(const Client clients[], int count, int client_id);
38 vold AddNewClient(const Client clients[], int count, int next_client_id];
39 vold DeleteClient(const Client clients[], int &count, int client_id];
62
std::string spectes;
std::string breed;
std::string name;
43 int main() {
03-
67
char gender;
trì 107;
09
struct Client
70
int client_id;
int *pet_list = new int[KMAXPETS];
73
74
80
}
68- else if(choice=2){
int client_id;
FindAndPrintPetInfo(clients, count, client_id);
84
86
Client clients[MAX_NUM];
int count = 0;
87
int client_id = 0;
int next_client_id = 8;
std::ifstream Infile;
71 }
infile.open(Filename);
72- else if(choice=3){
GetAllClients(clients, count, next_client_id];
AddNewClient clients, count, next_client_id);
75- else if(choice 4)
DeleteClient clients, count, client_id];
int choice;
do {
std::cout<<"1. Print out a bill for the client <std::endl;
std::cout<<"2. Print out the information on a pet for a client <std::endl;
std::cout<<"3. Add a client" << std::endl;
std::cout<<"4. Delete a client
std::endl;
std::cout<<"3.
Print the entire database clients" << std::endl;
std::cout<<"6. Quit and write out (update) the database << std::endl;
std::cin>> choice;
std::ctn.ignare();
if (choice - 1
PrintBlll(clients, count, client_id);
76
77 }
78- else if(choice-3)
79
}
81 } while (choice 1-6);
PrintAllClients(cllents, count);
std::ofstream outfile;
outfile.open(Filename);
SaveDatabase/clients, count, next_client_id);
autfile.close();
88}
89
90- /* Function GetAllClients: read the count, next_client_id, and client information from the file "client_database.dat" and stores them in the array clients[]
92 Inputs:
91
93 clients[] an array of Client structs
count -- a reference to an integer count
next_client_id -- a reference to the integer for the next client id number
97 - vold GetAllClients(Client clients[], int & count, int & nextcllent_id}{
98 std::ifstream Infile (Filename);
Transcribed Image Text:#include <iostream> #include <fstream> 3 // Define global constants for the maximum number of clients and pets here 4 const int MAX NUM - 28; 3 const int KMAXPETS - 7; 6 const std::string Filename="SampleRund.txt"; 7 8 // Define the struct for Pet here 9- struct Pet 10 11 12 13 14 15 }; COLORE岛同志网险应限内需易联网高安国际限内S 10 18 17 // define the struct for Client here 19 27 20 std::string name; std::string address; 21 22 float account balance; 23 int number of pets; 24 23 }; 28 // Function Prototypes 40 29 vold GetAllClients(Client clients[], int & count, int & next_client_id); 38 vold PrintAllClients(const client clients[], int count); 31 vold SaveDatabase(const Client clients[], int count, int next_client_id]; 32 57 58 39 33 Client ReadOneClient(std::lfstream 5); 34 int FindACLlent (const client clients[], int count, int client_id); 33 vold PrintB111(const Client clients[], int count, int client_td); 30 S5223885882EFRRRRRRS2328.82R====2258 37 vold FindAndPrintPetInfo(const Client clients[], int count, int client_id); 38 vold AddNewClient(const Client clients[], int count, int next_client_id]; 39 vold DeleteClient(const Client clients[], int &count, int client_id]; 62 std::string spectes; std::string breed; std::string name; 43 int main() { 03- 67 char gender; trì 107; 09 struct Client 70 int client_id; int *pet_list = new int[KMAXPETS]; 73 74 80 } 68- else if(choice=2){ int client_id; FindAndPrintPetInfo(clients, count, client_id); 84 86 Client clients[MAX_NUM]; int count = 0; 87 int client_id = 0; int next_client_id = 8; std::ifstream Infile; 71 } infile.open(Filename); 72- else if(choice=3){ GetAllClients(clients, count, next_client_id]; AddNewClient clients, count, next_client_id); 75- else if(choice 4) DeleteClient clients, count, client_id]; int choice; do { std::cout<<"1. Print out a bill for the client <std::endl; std::cout<<"2. Print out the information on a pet for a client <std::endl; std::cout<<"3. Add a client" << std::endl; std::cout<<"4. Delete a client std::endl; std::cout<<"3. Print the entire database clients" << std::endl; std::cout<<"6. Quit and write out (update) the database << std::endl; std::cin>> choice; std::ctn.ignare(); if (choice - 1 PrintBlll(clients, count, client_id); 76 77 } 78- else if(choice-3) 79 } 81 } while (choice 1-6); PrintAllClients(cllents, count); std::ofstream outfile; outfile.open(Filename); SaveDatabase/clients, count, next_client_id); autfile.close(); 88} 89 90- /* Function GetAllClients: read the count, next_client_id, and client information from the file "client_database.dat" and stores them in the array clients[] 92 Inputs: 91 93 clients[] an array of Client structs count -- a reference to an integer count next_client_id -- a reference to the integer for the next client id number 97 - vold GetAllClients(Client clients[], int & count, int & nextcllent_id}{ 98 std::ifstream Infile (Filename);
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Functions
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