Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Based on an automobile\'s model year and weight, the state of New Jersey determi

ID: 3628978 • Letter: B

Question

Based on an automobile's model year and weight, the state of New Jersey determines the weight class and registration fee by using the following schedule:
Model Year Weight Weight Class Registration Fee
1970 or earlier Less than 2700 lbs A 16.50
2700 to 3800 B 25.50
More than 3800 C 46.50
1971 to 1979 Less than 2700 lbs D 27.00



2700 to 3800 E 30.50
More than 3800 F 52.50
1980 or later Less than 3500 lbs G 19.50
3500 or more H 52.50

Using this information, write a C++ program that accepts an automobile's year and weight and determines and displays its weight class and registration fee. Please follow the same output format as given in the following example.

Please enter the year: 1974
Please enter the weight: 2800
The weight class is E
The registration fee is 30.50

Explanation / Answer

please rate - thanks

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{int year;
double weight,fee;
char klass;
cout<<"Please enter the year: ";
cin>>year;
cout<<"Please enter the weight: ";
cin>>weight;
if(year<=1970)
    {if(weight<2700)
         {klass='A';
         fee=16.50;
         }
     else if(weight<=3800)
         {klass='B';
         fee=25.50;
         }
     else
          {klass='C';
         fee=46.50;
         }
     }
else if(year<=1979)
        {if(weight<2700)
         {klass='D';
         fee=27.00;
         }
     else if(weight<=3800)
         {klass='E';
         fee=30.50;
         }
     else
          {klass='F';
         fee=52.50;
         }
     }
else
      {if(weight<3500)
         {klass='G';
         fee=19.50;
         }
     else
          {klass='H';
         fee=52.50;
         }
     }
cout<<"The weight klass is "<<klass<<endl;
cout<<"The registration free is $"<<setprecision(2)<<fixed<<fee<<endl;
system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote