Mar 20, 2017 at 3:37am UTC
#include<iostream>
#include <string>
using namespace std;
int main() {
//setting up numeral input
double loan_Payment;
double insurance;
double gas;
double oil;
double tires;
double maintenance;
double grand_Total;
grand_Total = (loan_Payment + insurance + gas + oil + tires + maintenance);
//setting up text input
std::cout.width(30); std::cout << std::left << "Loan Payment";
std::cin.width(15); std::cin >> std::right >> loan_Payment ;
std::cout.width(30); std::cout << std::left << "Insurance";
std::cin.width(15); std::cin >> std::right >> insurance;
std::cout.width(30); std::cout << std::left << "Gas" ;
std::cin.width(15); std::cin >> std::right >> gas;
std::cout.width(30); std::cout << std::left << "Oil";
std::cin.width(15); std::cin >> std::right >> oil;
std::cout.width(30); std::cout << std::left << "Tires";
std::cin.width(15); std::cin >> std::right >> tires;
std::cout.width(30); std::cout << std::left << "Maintenance";
std::cin.width(15); std::cin >> std::right >> maintenance;
std::cout.width(30); std::cout << std::left << "Total";
std::cin.width(15); std::cout << std::right << loan_Payment + insurance + gas + oil + tires + maintenance << endl;
std::cout.width(30); std::cout << std::left <<"Yearly Total";
std::cin.width(15); std::cout << std::right << 12 * (loan_Payment + insurance + gas + oil + tires + maintenance) << endl;
std::cout.width(30); std::cout << std::left << " 10%";
std::cin.width(15); std::cout << std::right << .10 * (loan_Payment + insurance + gas + oil + tires + maintenance) << endl;
//If the yearly total is greater than 1000 dollars, add 10 percent of the yearly total to the yearly total.
if (grand_Total > 1000) {
cout << ((12 * (loan_Payment + insurance + gas + oil + tires + maintenance) *(.10)) * (12 * (loan_Payment + insurance + gas + oil + tires + maintenance) ;
}
Last edited on Mar 20, 2017 at 3:38am UTC
Mar 20, 2017 at 3:43am UTC
There are improperly-nested parens on the second-to-last line.
Mar 21, 2017 at 5:31am UTC
Those kind of errors can be detected quickly after practicing a lot and it's very important. If your'e getting troubles detecting those errors you can try using a program as help. I tend to use checkmarx these days and it does a good job.
Anyway, good luck with that.
Ben.
Mar 21, 2017 at 9:51am UTC
@benhart,
if the tool you advertise is so great why don't you show use how it could solve this particular problem?
I suspect that you just want to advertise but are not really interested to help the OP to solve his problem.