Question

In: Computer Science

Copy the content of the source code into Visual Studio. Fill in the __BLANKS__ with proper...

Copy the content of the source code into Visual Studio. Fill in the __BLANKS__ with proper code and make it work! (HINT: you will be creating two files with this source code; one .cpp file and one .h file].

Please alter the code so that:

  • YOUR first and last name appears as the fourth customer [Make up your balance and phone number.]
  • Your Instructors first and last name appears as the fifth customer [Make up the balance and phone number.]
  • There is a $ symbol in front of all dollar amounts
  • The dollar amounts are aligned (right to left so that the cents symbol "." lines up)

CODE:

#include<iostream>
#include<cstring>
#include"customer.h"
using namespace std;
//The header file of the class CUSTOMER used is included
void main()
{
___BLANK___Credit;
printf("Customer Name       Payment Due \n");
printf("\n");
Credit=100.0;
for (int i=1; i<=3; i++) {
        CUSTOMER Customer;
        ___BLANK___.ConstCustomer(i);
        printf ("%s", Customer.ReturnCustomerName());
        printf("%4.2f \n", Customer.CustomerDue(Credit));
___BLANK___
}

//**** Class CUSTOMER definition ****
//File is "customer.h"
class CUSTOMER
//Class declaration
{
private:
//Attributes
int CustomerNumber;
___BLANK___ CustomerName[20];
___BLANK___ CustomerBalance;
char CustomerPhone[15];
public:
CUSTOMER ()
{
//Constructor is actually implemented by the method
//void ConstCustomer(int)
};

//Operations
//The following procedure simulates the system to read a 
//database/data file which records information of customer
void ConstCustomer(int CN) {
        CustomerNumber=CN;
        if (CustomerNumber==1)
        { strcpy_s(CustomerName, "John ");
          CustomerBalance=-200.05;
          strcpy_s(CustomerPhone, "123 1234");
        }
        if (CustomerNumber==2)
        {  strcpy_s(CustomerName, "Anne ");
           CustomerBalance=-200;
           strcpy_s(CustomerPhone, "123 2345");
        }
        if (CustomerNumber==3)
        { strcpy_s(CustomerName, "Greg ");
           CustomerBalance=100.78;
           strcpy_s(CustomerPhone, "123 7890");
        }
}

//Next are methods of the CUSTOMER class ...
___BLANK___     ___BLANK___
{return CustomerName;};
___BLANK___ *ReturnCustomerPhone()
{return CustomerPhone;};
double ReturnCustomerBalance()
{return CustomerBalance;};
double CustomerDue(double CR) {
        ___BLANK___   ___BLANK___   ___BLANK___
        if ((CustomerBalance+CR)<0)
        { DueAmount=(CustomerBalance+CR)*-1; }
        else
        {  DueAmount=0; };
        ___BLANK___ (DueAmount);
}
___BLANK___

Solutions

Expert Solution

no changes take in given code only  blanks are filled with appropriate content:

Raw_code:

customer.h:

class CUSTOMER
//Class declaration
{
private:
//Attributes
int CustomerNumber;
char CustomerName[20];
double CustomerBalance;
char CustomerPhone[15];
public:
CUSTOMER ()
{
//Constructor is actually implemented by the method
//void ConstCustomer(int)
};

//Operations
//The following procedure simulates the system to read a
//database/data file which records information of customer
void ConstCustomer(int CN) {
CustomerNumber=CN;
if (CustomerNumber==1)
{ strcpy_s(CustomerName, "John ");
CustomerBalance=-200.05;
strcpy_s(CustomerPhone, "123 1234");
}
if (CustomerNumber==2)
{ strcpy_s(CustomerName, "Anne ");
CustomerBalance=-200;
strcpy_s(CustomerPhone, "123 2345");
}
if (CustomerNumber==3)
{ strcpy_s(CustomerName, "Greg ");
CustomerBalance=100.78;
strcpy_s(CustomerPhone, "123 7890");
}

}

//Next are methods of the CUSTOMER class ...
char* ReturnCustomerName()
{return CustomerName;};
char *ReturnCustomerPhone()
{return CustomerPhone;};
double ReturnCustomerBalance()
{return CustomerBalance;};
double CustomerDue(double CR) {
double DueAmount ;
if ((CustomerBalance+CR)<0)
{ DueAmount=(CustomerBalance+CR)*-1; }
else
{ DueAmount=0; };
return (DueAmount);
}
};
customer.cpp:

#include<iostream>
#include<cstring>
#include"customer.h"
using namespace std;
//The header file of the class CUSTOMER used is included
int main()
{
double Credit;
printf("Customer Name Payment Due \n");
printf("\n");
Credit=100.0;
for (int i=1; i<=3; i++) {
CUSTOMER Customer;
Customer.ConstCustomer(i);
printf ("%s", Customer.ReturnCustomerName());
printf("%4.2f \n", Customer.CustomerDue(Credit));
}
}

code after adding my details and my instructors details:
only Raw_code and output:

customer.h:

class CUSTOMER
//Class declaration
{
private:
//Attributes
int CustomerNumber;
char CustomerName[20];
double CustomerBalance;
char CustomerPhone[15];
public:
CUSTOMER ()
{
//Constructor is actually implemented by the method
//void ConstCustomer(int)
};

//Operations
//The following procedure simulates the system to read a
//database/data file which records information of customer
void ConstCustomer(int CN) {
CustomerNumber=CN;
if (CustomerNumber==1)
{ strcpy_s(CustomerName, "John ");
CustomerBalance=-200.05;
strcpy_s(CustomerPhone, "123 1234");
}
if (CustomerNumber==2)
{ strcpy_s(CustomerName, "Anne ");
CustomerBalance=-200;
strcpy_s(CustomerPhone, "123 2345");
}
if (CustomerNumber==3)
{ strcpy_s(CustomerName, "Greg ");
CustomerBalance=100.78;
strcpy_s(CustomerPhone, "123 7890");
}
if (CustomerNumber == 4){
strcpy_s(CustomerName, "Krishna ");
CustomerBalance=-800.68;
strcpy_s(CustomerPhone, "369 7890");
}
if (CustomerNumber == 5){
strcpy_s(CustomerName, "Sai ");
CustomerBalance=-700.98;
strcpy_s(CustomerPhone, "369 9890");
}
}

//Next are methods of the CUSTOMER class ...
char* ReturnCustomerName()
{return CustomerName;};
char *ReturnCustomerPhone()
{return CustomerPhone;};
double ReturnCustomerBalance()
{return CustomerBalance;};
double CustomerDue(double CR) {
double DueAmount ;
if ((CustomerBalance+CR)<0)
{ DueAmount=(CustomerBalance+CR)*-1; }
else
{ DueAmount=0; };
return (DueAmount);
}
};

customer.cpp:

#include<iostream>
#include<cstring>
#include"customer.h"
using namespace std;
//The header file of the class CUSTOMER used is included
int main()
{
double Credit;
printf("Customer Name Payment Due \n");
printf("\n");
Credit=100.0;
for (int i=1; i<=5; i++) {
CUSTOMER Customer;
Customer.ConstCustomer(i);
printf ("%s", Customer.ReturnCustomerName());
printf("%4.2f \n", Customer.CustomerDue(Credit));
}
}

output:


Related Solutions

Download the attached file/s, copy and paste the code segment/s into your visual studio or any...
Download the attached file/s, copy and paste the code segment/s into your visual studio or any other C++ IDE and run it. You will have to implement a small intentional bug in your program // This program uses a function that returns a value. #include <iostream> using namespace std; // Function prototype int sum(int num1, int num2); int main() {    int value1 = 20,   // The first value        value2 = 40,   // The second value        total;         //...
Download the attached file/s, copy and paste the code segment/s into your visual studio or any...
Download the attached file/s, copy and paste the code segment/s into your visual studio or any other C++ IDE and run it. You will have to implement a small intentional bug in your program and post it for other students to debug. To be able to receive your full discussion points, you need to submit the following. Following is your check list and rubric       Attach your .cpp file/s with an implemented bug - 20pnts       Describe what the code...
After downloading the workbook example source-code for Microsoft Visual Studio 2015-2017 Community Ed., and installing, configuring,...
After downloading the workbook example source-code for Microsoft Visual Studio 2015-2017 Community Ed., and installing, configuring, and running Visual Studio with ASP.NET developers kit, develop and construct an APA formatted paper (also use LIRN (or JSTOR), Internet, and the textbook) that provides a detailed analysis of the following concepts: The importance and proper of data validation for applications The use of state(s), object(s) and their relationship to ASP.NET Strategies for the use and implementation of master pages to enhance content...
Please write in x86 Assembly language on Visual Studio. IRVINE32 Write a program to copy one...
Please write in x86 Assembly language on Visual Studio. IRVINE32 Write a program to copy one array of size 24 to another array of size 24 using string instructions. Write 3 versions of this code. One code must copy byte at a time. One code must copy word at a time and one code must copy double word at a time. Cut and paste the array in memory to show your code is working.
VISUAL STUDIO CODE Use a for loop for to create "password". Request the password at least...
VISUAL STUDIO CODE Use a for loop for to create "password". Request the password at least 3 times. If the password is 12345, the procedure ends, if the correct password entered, close excel saving changes. THANKS
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this...
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this part of the assignment, you are required to create a C# Console Application project. The project name should be A3<FirstName><LastName>P2. For example, a student with first name John and Last name Smith would name the project A1JohnSmithP2. Write a C# (console) program to calculate the number of shipping labels that can be printed on a sheet of paper. This program will use a menu...
I need the code for following in C++ working for Visual studio please. Thanks Use a...
I need the code for following in C++ working for Visual studio please. Thanks Use a Struct to create a structure for a Player. The Player will have the following data that it needs maintain: Struct Player int health int level string playerName double gameComplete bool isGodMode Create the 2 functions that will do the following: 1) initialize(string aPlayerName) which takes in a playername string and creates a Player struct health= 100 level= 1 playerName = aPlayerName gameComplete = 0...
Please use original C++ code for this. This is for visual studio. Program 5: Shipping Calculator...
Please use original C++ code for this. This is for visual studio. Program 5: Shipping Calculator The Speedy Shipping Company will ship packages based on how much they weigh and how far they are being sent. They will only ship small packages up to 10 pounds. You have been tasked with writing a program that will help Speedy Shipping determine how much to charge per delivery. The charges are based on each 500 miles shipped. Shipping charges are not pro-rated;...
Windows Interprocess communication. WM_CopyData IPC (data copy) - source code (c++) windows data copy IPC code
Windows Interprocess communication. WM_CopyData IPC (data copy) - source code (c++) windows data copy IPC code
using Visual Studio write a code containing a main() program that implements the coin change state...
using Visual Studio write a code containing a main() program that implements the coin change state machine in C++ according to the guidance given in Translating a state machine to C++ Test your code using prices 1 and 91 cents, and assume change is calculated from a dollar bill. Copy and paste your console output to a text editor and save the result in a single file named console.txt. Upload your exercise081.cpp and console.txt files to Canvas.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT