Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main()
- {
- int seconds, minutes;
- cin>>seconds;
- minutes = seconds / 60.0;
- cout<<"There are "<<setprecision(2)<<int(minutes)<<" minutes and "<<int(seconds%60)<<" seconds in "<<int(seconds)<<" seconds."<<endl;
- int fahrenheit;
- cin>>fahrenheit;
- int celsius = (5.0 / 9) * (fahrenheit - 32);
- cout<<"There are "<<celsius<<" degrees Celsius in "<<fahrenheit<<" degrees Fahrenheit."<<endl;
- double price, tax, total;
- cin>>price;
- tax = price * .06;
- total = price + tax;
- cout<<fixed<<"Your item costs "<<price<<" dollars, the tax is "<<tax<<" dollars, and the price after tax is "<<setprecision(2)<<total<<" dollars."<<endl;
- double annualInterestRate, monthlyInterestRate, loanAmount, numberOfYears, monthlyPayment, totalPayment;
- cout<<"Please input your Annual Interest Rate in digits.\n";
- cin>>annualInterestRate;
- cout<<"Please input your number of years in digits.\n";
- cin>>numberOfYears;
- cout<<"Please input your Loan Amount in digits.\n";
- cin>>loanAmount;
- monthlyInterestRate = annualInterestRate / 1200;
- monthlyPayment = (loanAmount * monthlyInterestRate) / (1 - (1/pow((1+monthlyInterestRate),(numberOfYears*12))));
- totalPayment = monthlyPayment*(numberOfYears*12);
- cout<<fixed<<"Your Monthly Payment is "<<monthlyPayment<<" dollars and your Total Payment is "<<totalPayment<<" dollars."<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement