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
|
#include<iostream>
#include<conio.h>
#include<fstream>
#include<iomanip>
using namespace std;
void displayFirstAndLast(const std::string& firstName, const std::string& lastName);
void headerfn();
string creditcardfn();
void verifycard();
void info();
void averageDailyBalancefn(double);
double APRfn();
void interestfn();
void outputfn(string firstName,string lastName,double interest,double APR,double averageDailyBalancefn,double netBalance,double payment,double d1,double d2,string cc,string verify
);
int main(){
headerfn();
string firstName;
string lastName;
cout << "Please enter your first and last name " <<endl;
cin >> firstName >> lastName;
displayFirstAndLast(firstName, lastName);//end input for name
string cc;
creditcardfn();//input for cc
string verify;
verifycard();
info();
APRfn();
double APRfn,averageDailyBalancefn,interest,netBalance, payment, d1, d2;cc;
outputfn(firstName,lastName,interest,APRfn,averageDailyBalancefn,netBalance,payment,d1,d2, cc, verify
);
//calculates inputs for netBalance, d1, payment, d2, and d1 again for
//what averageDailyBalance is
//this is where output will go for text file and below is rules?
cout<<"press any key to continue\n";
getch();
return 0;
}
//******************************************************************************
void headerfn(){
//void function without parameters
cout<<"=***************************************="<<endl;
cout<< "* Date: April 11th 2017 *"<<endl;
cout<< "* Credit Card Interest Calculator *"<<endl;
cout<<"=***************************************="<<endl;
cout << "\n";
//adds space to program output
cout<< "This Program calculates the interest on unpaid"<<endl;
cout<< "credit card balances using the average daily balance"<<endl;
//outputs information for program user to know what program does
cout<< "\n";
cout<<endl<<endl;
//adds space to program output
}//end of headerfn
//******************************************************************************
void displayFirstAndLast(const std::string& firstName, const std::string& lastName){
std::cout << "You are " << firstName << " " << lastName << std::endl;}
//******************************************************************************
string creditcardfn(){//value returning function
string cc;
cout << "Please enter the credit card number: ";
cin >> cc;
//prompts user to enter credit card number and inputs their entry
cout << "\n";
//adds space to program output
cout << "You entered " <<cc <<endl;
//outputs what user entered for credit card number
cout << "\n";
//adds space to program output
return cc;
}
//where to read credit card with value returning function
//******************************************************************************
void verifycard(){ string verify;
cout << "If this is correct, press 0 or 1 to try again: ";
cin >> verify;
//prompts user to press 0 or 1 if credit card number is correct
while (verify !="0"){
//prompts program to output the following if input not zero
cout<< "\n";
//outputs a space
cout << "Please enter the credit card number: ";
//prompts user to enter their credit card number
cin >>verify;
//inputs what user put in for credit card number
cout<< "\n";
//outputs a space
cout <<"You entered " <<verify;
//outputs what user put in for credit card number
cout << "\n";
cout << "\n";
//outputs a space
//outputs a space
cout << "If this is correct, press 0 or 1 to try again: ";
//prompts user to press 0 if credit card number is correct, 1 to try again
cin >> verify;
//inputs what user types in for if correct
cout << "\n";
//outputs a space
//adds space to program output
}//end of while
cout << "\n";
//outputs a space
}
//use void function to verify card
//******************************************************************************
//Read the balance shown in bill (netBalance), payment made (payment), days in billing cycle (d1), and number days
//payment made before billing cycle (d2) using a void function
void info(){double netBalance, payment, d1,d2;
cout<< "Please enter balance on credit card bill ";
//prompts user to enter balance on credit card bill
cin >> netBalance;
//inputs netBalance, what user entered.
cout << "\n";
//adds space to program output
cout << "You entered $" <<netBalance <<endl;
//outputs netBalance that user input
cout << "\n";
//adds space to program output
cout << "Please enter the payment you made: ";
//prompts user to enter payment made
cin >> payment;
//inputs payment user enters
cout << "\n";
//adds space to program output
cout << "You entered $" <<payment <<endl;
//outputs payment user enters
cout << "\n";
//adds space to program output
cout << "Please enter the number of days in the billing cycle: ";
//prompts user to enter number of days in billing cycle
cin >> d1;
//inputs what user types for d1
cout << "\n";
//adds space to program output
cout << "You entered " <<d1 <<endl;
//outputs what user types for d1
cout << "\n"; //adds space to program output
cout << "Please enter the number of days payment was made before billing cycle: ";
//prompts user to enter number of days payment was made before billing
cin >> d2;
//inputs what user types for d2
cout << "\n"; //adds space to program output
cout << "You entered " <<d2 <<endl;
//outputs what user types for d2
cout << "\n"; //adds space to program output
}
//******************************************************************************
//???????????
void averageDailyBalancefn(double averageDailyBalancefn,double netBalance,double d1,double d2,double payment){
averageDailyBalancefn = (netBalance * d1 - payment * d2)/d1;
}
//average daily balance void
//******************************************************************************
double APRfn(){double averageDailyBalancefn,APR;
if (averageDailyBalancefn<100.00) {
APR=5;}
// Executes when the average daily balance is less
//than 100.00
else if (averageDailyBalancefn<1000.00) {
APR=10;}
// Executes when the average daily balance is less
//than 1000.000
else (averageDailyBalancefn>1000.00); {
APR=15;}
(more code but wouldnt let me post it)
|