Question with outputting to file

Hey guys/gals have a question...my program wont output any information to the txt file that I have specified it just creates it but it leaves it blank :( . Here's the code hopefully someone can help me :)
thanks :)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#include <iostream>
#include<string>
#include<iomanip>
#include <fstream>
using namespace std;





class Carloan
{
private:
    string applicantName;
    string coApplicantName;
    string applicantLastName;
    string coApplicantLastName;
    int creditScore1;
    int creditScore2;
    int months;
    int numberOfApplicants;
    double interest;
    double downPayment;
    double montlyPayment;
    double totalIncome;
    double vehicleSellingPrice;
    double totalVehiclePrice;
    double carTotalInterest;
    double creditScore3;
public:
    void Carloan::welcome();
    int Carloan::applicantsInfo();
    double Carloan::carAndCredit();
    void Carloan::displayCarloanElig();
    
    
    
    

};
void Carloan::welcome()
{
  cout << "Welcome to JB Carloan Financial" << endl;
  cout << "Please follow the steps and enter the requiere amounts correct" << endl;

}
int Carloan::applicantsInfo()
{
    
    cout << "Will there be one applicant or two?" << endl;
    cin >> numberOfApplicants;
     { 
       if (numberOfApplicants == 1)
         {
               cout << "Please enter the first and last name of the main Applicant " << endl;
               cin >> applicantName  >> applicantLastName;
               cout << "Please enter the total income of the Applicant after all payments" << endl;
               cin >> totalIncome ;
               cout << "Please enter the credit score of the Applicant " << endl;
               cin >> creditScore1 ;
         }
       else
         {
               cout << "Please enter the first and last name of the main Applicant " << endl;
               cin >> applicantName  >> applicantLastName;
               cout << "Please enter the first and last name of the Co Applicant" << endl;
               cin >> coApplicantName >> coApplicantLastName;
               cout << "Please enter the total income of both applicants after all payments" << endl;
               cin  >> totalIncome ;
               cout << "Please enter the credit score of the applicants" << endl;
               cin >> creditScore1 ;
               cout << "Please enter the credit score of the Co Applicant" << endl;
               cin >> creditScore2 ;
               cout << "  " << endl;
               creditScore3 = ((creditScore1 + creditScore2)/2);
         }
         
         
  }                                                                                                     
}
double Carloan::carAndCredit()
{

    
      if (numberOfApplicants == 1)
       { 
         if ( creditScore1 < 500) 
           {
            interest= .2599;
           }
         else if ((creditScore1 >= 500) && (creditScore1 <=589))
           {
            interest= .1521;
           }
        else if ((creditScore1 >= 590) && (creditScore1 <= 619))
           {
            interest= .1184;
           }
        else if ((creditScore1 >= 620) && (creditScore1 <= 689))
           {
            interest = .8800;
           }
           
        else if ((creditScore1 >= 690) && (creditScore1 <= 719))
           {
            interest = .5890;
           }
        else
           {
            interest= .3890;
           }
        }
    else 
    
     {
        if (creditScore3 < 499)
           {
            interest= .2599;
           }
        else if ((creditScore3 >= 500) && (creditScore3 <=589))
        {
            interest= .1521;
        }
        else if ((creditScore3 >= 590) && (creditScore3 <= 619))
        {
            interest= .1184;
        }
        else if ((creditScore3 >= 620) && (creditScore3 <= 689))
        {
            interest = .8800;
        }
        else if ((creditScore3 >= 690) && (creditScore3 <= 719))
        {
            interest = .5890;
        }
        else 
         {
            interest= .3890;
         }
    }
    
    
    cout << "Please enter the total price of the vehicle. " <<endl;
    cin >> vehicleSellingPrice;
    cout << "Please enter the number of months you wish to finance the car for " << endl;
    cout << "The available months are 24, 36, 48, and 60." << endl;
    cin >> months;
    cout << "Will there be a downpayment? If not type 0." <<endl;
    cin >> downPayment;
    cout << "  " << endl;


}

void Carloan::displayCarloanElig()
{ 
    
 
 
 
      totalVehiclePrice = (vehicleSellingPrice - downPayment);
      carTotalInterest = (totalVehiclePrice * interest);
      montlyPayment = ((totalVehiclePrice / months) + (carTotalInterest/months));
   
 
 if ((totalIncome - 400) > montlyPayment)
  {
   if (numberOfApplicants == 1)
    cout << "We are please to inform that " << applicantName << " " <<  applicantLastName << " has been approved for the loan." << endl;
    
    else
    cout << "We are please to inform that " << applicantName <<" "<<  applicantLastName << " and "  << coApplicantName<<" " << coApplicantLastName << " have been approved for the loan." << endl;
         
    cout << setprecision(2);
    cout << "The estimated montly payments are: " << fixed << montlyPayment <<  " for " << months << " months." << endl;
    cout << "We thank you for your business." << endl;
   }
 else
   {
   cout << "We are sorry at this time we cannot offer you with a loan. " << endl;
   cout << "In 30 days you will recieve a letter stating why. Thank you." << endl;
   }
  
}




int main()
{
        
    ofstream outFile;
    
    
    
    outFile.open("CarLoan.txt");

      Carloan aCarloan;
      aCarloan.welcome();
      aCarloan.applicantsInfo();
      aCarloan.carAndCredit();
      aCarloan.displayCarloanElig();
  
    
       
    outFile.close();
	  
	  system("PAUSE");
	  return 0;

    




}
You open and close the file but you never write anything to it.
soooo it wont write whats on my class? is there a way to write that info there??
Last edited on
Topic archived. No new replies allowed.