79155169

Date: 2024-11-04 11:07:45
Score: 0.5
Natty:
Report link

The course material had an example of a system for a shop and its shopping cart module. Earlier, we've also created Person and Customer objects. Create a customer registry module for the shop, in which customer information can be saved to and fetched from.

The module's functions should be as follows:

add(firstname, lastname). An ID is automatically created for each customer, starting from 0 and counting up.

customerInfo(id). Find a customer based on their ID, and print their name. This can use the name method inherited from the Person object. If the specified ID doesn't exist - in other words, that many customers have not yet been added - print "Too high an ID value!" instead.

customerList(). Print all the customer information in the form of [ID]: [Last name] [First name].

Example output: Too high an ID value! Added customer with ID 0 Added customer with ID 1 Listing all customers: 0: Programmer Pete 1: Coder Cara Added customer with ID 2 Added customer with ID 3 Listing all customers: 0: Programmer Pete 1: Coder Cara 2: Scripter Samuel 3: Webmaster Wendy

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: AHMED AL-FARS