Implement a class Customer containing the following information. Keep in mind that some of the following assignments will make use of this class.
• Customer id number
• First name
• Last name
Remember that information should be kept private if possible. All 3 of the above parameters should be passed to the class via the constructor. Create an array that can store customers. Make it sufficiently large, e.g. 20. Once the program is started, it will print out the prompt "customers " ( is followed by a whitespace):
You will implement the commands "add", "remove", "print" and "quit":
Add takes 3 arguments, representing the individual attributes in the order listed above. Store the new customer in the next available array spot. If a customer id already exists, print out an error message starting with "Error!" Then repeat the prompt. You can assume that there are no spaces within the attribute values specified by the user. customers add 7 James Bond customers add 4345 Bugs Bunny customers add 5 Donald Duck customers
Remove takes the customer id as an argument. Remove the customer with corresponding id and print out true. If there is no customer with such an id print out false. Since you are using an array to store the customers, make sure to close "gaps" by moving the last customer in the array to the vacant spot. Then repeat the prompt.
customers remove 123
customers remove 7
Print takes no arguments. Print the attributes of the customers from left to right starting with the customer at array position 0. Separate the individual attributes by commas, place parenthesis around the attributes belonging to a specific customer and separate customers using hyphens. There should be no hyphen after the last element. Then repeat the prompt.
Exit the program customers quit
• If a customer id already exists when attempting to add a customer, print out an error message starting with "Error!". (Do not capitalize the entire word "Error")
• If a customer id contains other characters than digits, print out an error message starting with "Error!". (Do not capitalize the entire word "Error")
• If the user types a command that is not supported, print out an error message starting with
"Error!". (Do not capitalize the entire word "Error")
Submit AT LEAST the following files:
• Your main file controling the flow of the program
• The prototype file for your customer class.
• The implementation file for your customer class.
Example of program execution:
customers add 7 James Bond
customers print (7,James,Bond) customers add 3229 Bugs Bunny customers add 230 Donald Duck customers print
(7,James,Bond)-(3229,Bugs,Bunny)-(230,Donald,Duck) customers remove 7 true
(230,Donald,Duck)-(3229,Bugs,Bunny) customers remove 123
false customers hi
Error! Enter add, remove, print or quit.
customers add 11a Papa Smurf
Error! Invalid id. Ids may only contain digits.
customers add 111 Papa Smurf
Your program will be judged on the following:
• 13 points - Passes I/O requirements
• 13 points - Code satisfies requirements of assignment
• 4 points - Professional coding style
- 1 points Adequate comments
- 2 points Modularity (small main function, separate functions, etc) - 1 points Readability (line length, indentation, variable names)