Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Read the following C++ program and complete it by filling in the blanks: 1 #include 2 #include 3 #includecustomer.h 4 using namespace std; 5//The header
Read the following C++ program and complete it by filling in the blanks:
1 #include2 #include 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 "); 10 printf(" "); 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 ", 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]; C++ 51 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 _____________________
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started