-
Notifications
You must be signed in to change notification settings - Fork 2
/
Housing_Costs.cpp
51 lines (36 loc) · 1.21 KB
/
Housing_Costs.cpp
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
/*
Housing Costs
Write a program that asks the user to enter their monthly costs for each of the following
housing-related expenses:
• rent or mortgage payment
• phones
• utilities
• cable
The program should then display the total monthly cost of these expenses and the total
annual cost of these expenses.
*/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
double rOrM, phoneBill, utilities, cable, total;
cout << "This program will calculate your Housing Costs!" << endl << endl;
cout << "Enter your monthly rent or mortgage payment: $" ;
cin >> rOrM;
cout << "Enter monthly phone payment: $";
cin >> phoneBill;
cout << "Enter monthly utility payment: $";
cin >> utilities;
cout << "Enter monthly cable payment: $";
cin >> cable;
total = (rOrM + phoneBill + utilities + cable);
cout << endl;
cout << setprecision(2) << fixed;
cout << "The monthly cost of these expenses is: $" << total << endl;
total = total * 12;
cout << "The annual cost of these expenses is: $" << total << endl;
system("pause");
return (0);
}