Hello! I'm new to the site and I'm having trouble compiling my program. I was hoping that somebody can take a look at my code and try to point me in the right direction. It's a charge account program that consist of using a repetition control structure. Here are the instructions:
a) customers name
b) account # (an integer)
c) Balance at the beginning of the month
d) Total items charged
e) Total of all payment credits applied
f) Allowed credit limitThe program should input each of these facts, and calculate the customer’s new balance. It should not allow the user to enter a negative value for either the charges or the credits. If a negative value is entered for any of these two variables, a warning should be displayed that the user cannot proceed until the user enters a valid value. Next, the program should evaluate the customer’s new balance, to determine if it exceeds their credit limit. If this happens, an over the limit charge of $50 is imposed and display a message. The program should then display the customer’s name, account number, credit limit and new balance. If the user enters ‘y’, the program should prompt and receive entries for the next customer and perform the same calculations. If user enters ‘n’, the program should print a report and then terminate.
Here is my code:
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
int cust_name, // Customer's Name
acct_number, // Account Number
total, // Sum of customers
cust_counter, // Number of Customers counted
yes = 0, // Prompt and Receive entries
no = 0, // Print a summary report
result,
double beg_balance, // Beginning Balance
new_balance, // New Balance
total_charges, // Total Charges
total_credits, // Total Credits
cred_limit; // Allowed Credit Limit
// initialization phase
total = 0;
cust_counter = 0;
// Processing Phase
Console::Write(S" Enter Customer's Name: ");
cust_name = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Account Number: ");
acct_number = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Beginning Balance: ");
beg_balance = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Total Charges: ");
total_charges = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Total Credit: ");
total_credits = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Credit Limit: ");
cred_limit = Int32::Parse(Console::ReadLine());
// Enter Loop
while(new_balance >= 0);
{
Console::Write(S" Enter New Balance: ");
new_balance = Int32::Parse(Console::ReadLine());
new_balance = beg_balance + total_charges -
total_credits;
cust_counter = new_balance + 1;
} //end while
if (cust_counter >= 0);
{
Console::WriteLine(S" Credit Limit Doesn't Exceed
Limit ");
} //end if
else
Console::WriteLine(S" Warning: Credit Limit
Exceeded!!! \n Over the limit charge of $50
imposed ");
while
{
Console::Write(S" Enter Customer's Name: ");
cust_name = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Account Number: ");
acct_number = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Beginning Balance: ");
beg_balance = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Total Charges: ");
total_charges = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Total Credit: ");
total_credits = Int32::Parse(Console::ReadLine());
Console::Write(S" Enter Credit Limit: ");
cred_limit = Int32::Parse(Console::ReadLine());
Console::WriteLine(S" Is there another customer to
be processed? (1=yes, 2=no): ");
result = Int32::Parse(Console::ReadLine());
// if result is 1, increment cust_name; if-else end while
if (result == 1)
yes = yes + 1;
else
no = no + 1;
// increment counter so loop can terminate
cust_name = cust_name + 1;
} // end while
// termination phase
Console ::WriteLine(S" \n Yes: {0} \n No: {1} ", yes.ToString(), no.ToString());
return 0;
}
If you can help me with this I would appreciate it ;)