Loop counter issues

Hey everyone,

I am new to the site and need a little help in my homework assignment. This thing is giving me fits and need to have a payment calculator for a doctors office.

The format according to the teacher is like this:

PATIENT ACCOUNT NUMBER: 1234
CONSULTATION DATE: 12/20/2010

TREATMENT FEE: $2500.00
INITIAL PAYMENT: 300.00
BALANCE DUE: 2200.00

PAYMENT DUE PAYMENT TOTAL OUTSTANDING
NUMBER DATE AMOUNT PAID BALANCE

1 01/01/10 75.00 375.00 2125.00
2 02/01/10 75.00 450.00 2050.00
..........
29 .... 75.00 2475.00 25.00
30 .... 25.00 2500.00 0.00
********** PAYMENT SCHEDULE PRINTED BY: STUDENT NAME ********************

here is the code so far

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//Jason Krizman
//cop2000
//assignment 3

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#define NAME Jason Krizman


using namespace std;

int main ()
{
    int ACCU; // Patient account number
    int CONSM; // Consultation date month
    int CONSD; // Consultation date day
    int CONSY; // Consultation date year
    char SLASH; // Unsed / in date
    float FEE; // Treatment fee
    float INIT; // Initial payment
    float TOTAL; // Total balance due
    int C; // Counter
    int NPAY; // Numbered payments
    int DPAY; // Payment due dates
    float TPAY; // Total amount payed
    float BAL; // Outstanding balance
    
   

    system ("cls"); // Clear the screen
    
    
/* Data Input Section */
    cout << "PATIENT ACCOUNT NUMBER: ";
    cin >> ACCU;
    
if (ACCU <= 1000 || ACCU >= 9999)
{
    cout << "Please enter a correct account value.";
}

else
{
    cout << "CONSULTATION DATE: ";
}
    
    cin >> CONSM;
    cin >> SLASH;
    cin >> CONSD;
    cin >> SLASH;
    cin >> CONSY;
    
    if (CONSM < 1 || CONSM > 12) cout << "Please enter a valid date.";
    else if (CONSD < 1 || CONSD > 31) cout << "Please enter a valid date.";
  
     
    cout << "TREATMENT FEE: $ ";
    cin >> FEE;
    
    cout << "INITIAL PAYMENT: $ ";
    cin >> INIT;
    
    BAL = FEE - INIT;
    
    cout << "BALANCE DUE: $ " << BAL;
    
    cout << " " << endl;
    cout << setw(10) << "PAYMENT" <<setw(10) << "DUE"  << setw(10) << "PAYMENT" << setw(10) << "TOTAL" << setw(13) << "OUTSTANDING" << endl;
    cout << setw(10) << "NUMBER" <<setw(10) << "DATE"  << setw(10) << "AMOUNT" << setw(10) << "PAID" << setw(10) << "BALANCE" << endl;

	int a = 1;
	
	C = 75;

	for (float i = BAL; i >= 0; i = i - C)
		
		TPAY = C + INIT;

	{
		cin >> C; cout << setw(10) << a++ ; cout <<setw(10) << CONSD << SLASH << CONSM << SLASH << CONSY << setw(10) << C << setw(10) << TPAY << setw(10) << BAL << endl;
	}

    system ("PAUSE");
    
    return 0;
}

any help or will be greatly appreciated
Last edited on
It would be helpful if you could tell us what your problem is. Are you having errors? If yes please copy paste them. Is something not working as intended? Tell us what that is.
Sorry tarik..basically my output is not calculating correctly and trying to figure out whether my calculations are in the wrong place and any suggestions in the loop. I the dates need to add a month to each payment as well. Also i have a pesky blank prompt to enter the $75 to calculate it when it needs to be in the loop as a formula to add to the total paid column.

PATIENT ACCOUNT NUMBER: 1234

CONSULTATION DATE: 1/1/2015
TREATMENT FEE: $ 2500.00

INITIAL PAYMENT: $ 300.00

BALANCE DUE: $ 2200

PAYMENT DUE PAYMENT TOTAL OUTSTANDING
NUMBER DATE AMOUNT PAID BALANCE

75.00 <---some reason it needs to be automatically added to the total pay
and not a prompt
1 2/1/2015 75 2275 2200
2 2/1/2015 75 2200 2125
3 2/1/2015 75 2125 2050
4 2/1/2015 75 2050 1975
5 2/1/2015 75 1975 1900

Press any key to continue . . .
Last edited on
Topic archived. No new replies allowed.