-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q10Ex4.3.cpp
72 lines (68 loc) · 1.55 KB
/
Q10Ex4.3.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
write, compile, and run a C++ program that accepts an automobile’s
year and weight and determines and displays its weight class and registration fee.
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int model;
double weight;
int weightClass;
double registrationFee;
cout << "Enter the automobile's model year: ";
cin >> model;
cout << "Enter the automobile's weight (in lbs): ";
cin >> weight;
if (model <= 1990)
{
if (weight < 2700)
{
weightClass = 1;
registrationFee = 26.50;
}
else if (weight <= 3800)
{
weightClass = 2;
registrationFee = 35.50;
}
else
{
weightClass = 3;
registrationFee = 56.50;
}
}
else if (model>= 1991 && model <= 1999)
{
if (weight < 2700) {
weightClass = 4;
registrationFee = 35.00;
}
else if (weight <= 3800)
{
weightClass = 5;
registrationFee = 45.50;
}
else
{
weightClass = 6;
registrationFee = 62.50;
}
}
else if (model>= 2000)
{
if (weight < 3500)
{
weightClass = 7;
registrationFee = 49.50;
}
else
{
weightClass = 8;
registrationFee = 62.50;
}
}
cout << "Weight Class: " << weightClass << endl;
cout << "Registration Fee: $" << registrationFee;
return 0;
}