3. (20 scores)

3. (20 scores)#

Complete 3 classes called Date, Item and Customer. Make the following function named main can output correctly.

main.cpp#
 1#include <iostream>
 2
 3#include <string.h>
 4
 5using namespace std;
 6
 7class Date {
 8 public:
 9  // ...
10
11 private:
12  int year;
13  int month;
14  int day;
15};
16
17class Items {
18 public:
19  // ...
20
21 private:
22  char item_name[20];
23  int number;
24  double price;
25};
26
27class Customer {
28  // ...
29};
30
31auto main() -> int {
32  Date d1(2022, 6, 18);
33  Customer c1("11000001", d1);
34  c1.selectItem("cup", 2, 9.2);
35  c1.selectItem("jacket", 1, 50);
36  c1.selectItem("steak", 3, 10);
37  c1.print();
38  return 0;
39}
output#
1Customer ID:11000001
2Purchase Date:2022-6-18
3The Purchase items are listed as follows:
41: itemName: cup,number: 2,price: 9.2,amount: 18.4
52: itemName: jacker,number: 1,price: 50,amount: 50
63: itemName: steak,number: 3,price: 10,amount: 30
7The total amount of the Purchase items is 98.4