Read the following C++ program and complete it by filling in the blanks:
1 #include<iostream>
2 #include<cstring>
3 #include”customer.h”
4 using namespace std;
5//The header file of the class CUSTOMER used is included
6 void main()
7 {
8 ________ Credit;
9 printf(“Customer Name Payment Due n”);
10 printf(“n”);
11 Credit=100.0;
12 for (int i=1; i<=3; i++) {
13 CUSTOMER Customer;
14 ______________.ConstCustomer(i);
15 printf (“%s”, Customer.ReturnCustomerName());
16 printf(” %4.2f n”, Customer.CustomerDue(Credit));
17 _______________
18 }
1 // **** Class CUSTOMER definition ****
2 // File is “customer.h”
3 class CUSTOMER
4 // Class declaration
5 {
6 private:
7 // Attributes
8 int CustomerNumber;
9 __________ CustomerName[20];
10 __________ CustomerBalance;
11 char CustomerPhone[15];
12 public:
13 CUSTOMER ()
14 {
15 // Constructor is actually implemented by the method
16 // void ConstCustomer(int)
17 };
18 // Operations
19 // The following procedure simulates the system to read a
20 //database/data file which records information of customer
21 void ConstCustomer(int CN) {
22 CustomerNumber=CN;
23 if (CustomerNumber==1)
24 { strcpy_s(CustomerName, “John “);
25 CustomerBalance=-200.05;
26 strcpy_s(CustomerPhone, “123 1234 “);
27 }
28 if (CustomerNumber==2)
29 { strcpy_s(CustomerName, “Anne “);
30 CustomerBalance=-200;
31 strcpy_s(CustomerPhone, “123 2345 “);
32 }
33 if (CustomerNumber==3)
34 { strcpy_s(CustomerName, “Greg “);
35 CustomerBalance=100.78;
36 strcpy_s(CustomerPhone, “123 7890 “);
37 }
38 }
39 // Next are methods of the CUSTOMER class…
40 __________ _____________________
41 {return CustomerName;};
42 __________ *ReturnCustomerPhone()
43 {return CustomerPhone;};
44 double ReturnCustomerBalance()
45 {return CustomerBalance;};
46 double CustomerDue(double CR) {
47 _____________ ____________ ______
48 if ((CustomerBalance+CR)<0)
49 { DueAmount=(CustomerBalance+CR)*-1; }
50 else
51 { DueAmount=0; };
52 _____________ (DueAmount);
53 }
54 _____________________
Expert Answer
1 #include<iostream>
2 #include<cstring>
3 #include”customer.h”
4 using namespace std;
5//The header file of the class CUSTOMER used is included
6 void main()
7 {
8 float Credit;
9 printf(“Customer Name Payment Due n”);
10 printf(“n”);
11 Credit=100.0;
12 for (int i=1; i<=3; i++) {
13 CUSTOMER Customer;
14 Customer.ConstCustomer(i);
15 printf (“%s”, Customer.ReturnCustomerName());
16 printf(” %4.2f n”, Customer.CustomerDue(Credit));
17 return customer
18 }
1 // **** Class CUSTOMER definition ****
2 // File is “customer.h”
3 class CUSTOMER
4 // Class declaration
5 {
6 private:
7 // Attributes
8 int CustomerNumber;
9 Customer CustomerName[20];
10 Customer CustomerBalance;
11 char CustomerPhone[15];
12 public:
13 CUSTOMER ()
14 {
15 // Constructor is actually implemented by the method
16 // void ConstCustomer(int)
17 };
18 // Operations
19 // The following procedure simulates the system to read a
20 //database/data file which records information of customer
21 void ConstCustomer(int CN) {
22 CustomerNumber=CN;
23 if (CustomerNumber==1)
24 { strcpy_s(CustomerName, “John “);
25 CustomerBalance=-200.05;
26 strcpy_s(CustomerPhone, “123 1234 “);
27 }
28 if (CustomerNumber==2)
29 { strcpy_s(CustomerName, “Anne “);
30 CustomerBalance=-200;
31 strcpy_s(CustomerPhone, “123 2345 “);
32 }
33 if (CustomerNumber==3)
34 { strcpy_s(CustomerName, “Greg “);
35 CustomerBalance=100.78;
36 strcpy_s(CustomerPhone, “123 7890 “);
37 }
38 }
39 // Next are methods of the CUSTOMER class…
40 __________ _____________________
41 {return CustomerName;};
42 Customer *ReturnCustomerPhone()
43 {return CustomerPhone;};
44 double ReturnCustomerBalance()
45 {return CustomerBalance;};
46 double CustomerDue(double CR) {
47 _____________ ____________ ______
48 if ((CustomerBalance+CR)<0)
49 { DueAmount=(CustomerBalance+CR)*-1; }
50 else
51 { DueAmount=0; };
52 Customer (DueAmount);
53 }
54 return customer.