Ask Question
4 January, 19:47

Write multiple if statements. If car_year is 1969 or earlier, print "Few safety features." If 1970 or later, print "Probably has seat belts." If 1990 or later, print "Probably has antilock brakes." If 2000 or later, print "Probably has airbags." End each phrase with a period and a newline. Sample output for input: 1995

+5
Answers (1)
  1. 4 January, 20:17
    0
    Explanation along with code and output results is provided below.

    C+ + Code:

    #include

    using namespace std;

    int main ()

    {

    int year;

    cout<<"Enter the car model year."<
    cin>>year;

    if (year<=1969)

    {

    cout<<"Few safety features."<
    }

    else if (year>=1970 && year<1989)

    {

    cout<<"Probably has seat belts."<
    }

    else if (year>=1990 && year<1999)

    {

    cout<<"Probably has antilock brakes."<
    }

    else if (year>=2000)

    {

    cout<<"Probably has airbags."<
    }

    return 0;

    }

    Explanation:

    The problem was to print feature messages of a car given its model year.

    If else conditions are being used incorporate the logic. The code has been tested with several inputs and got correct output results.

    Output:

    Enter the car model year.

    1961

    Few safety features.

    Enter the car model year.

    1975

    Probably has seat belts.

    Enter the car model year.

    1994

    Probably has antilock brakes.

    Enter the car model year.

    2005

    Probably has airbags.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write multiple if statements. If car_year is 1969 or earlier, print "Few safety features." If 1970 or later, print "Probably has seat ...” in 📗 Engineering if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers