Question

In: Computer Science

Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without...

Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without quotes). If after 1971, print "Probably has head rests.". If after 1991, print "Probably has anti-lock brakes.". If after 2002, print "Probably has airbags.". End each phrase with period and newline. Ex: carYear = 1995 prints:

Probably has head rests.
Probably has anti-lock brakes.          

I want the answers in C++ not in java script data type

Solutions

Expert Solution

Source Code:

Output:

Code to Copy (refer above images of code for indentation):

/*include header file*/
#include <iostream>
using namespace std;
/*main function*/
int main()
{
   /*variable*/
   int y;
   /*read car year from user*/
   cout<<"Enter carYear: ";
   cin>>y;
   /*check condition and print respective message*/
   if(y<1968)
       cout<<"Probably has few safety features."<<endl;
   if(y>1971)
       cout<<"Probably has head rests."<<endl;
   if(y>1991)
       cout<<"Probably has anti-lock brakes."<<endl;
   if(y>2002)
       cout<<"Probably has airbags."<<endl;
return 0;
}


Related Solutions

What probably happened that a government decided it needed to print the below banknote? (Write a...
What probably happened that a government decided it needed to print the below banknote? (Write a minimum of 100 words in your answer)
Write anoutput(number)functionthat printsout information according to the requirements below.-If numberis a multiple of 3and 4, print"Multiple...
Write anoutput(number)functionthat printsout information according to the requirements below.-If numberis a multiple of 3and 4, print"Multiple of 3 and 4". -If numberis onlya multiple of 4, print "Multiple of 4".-If numberis onlya multiple of 3, print "Multiple of 3". -If numberis not a multiple of 3or 4, print "Not a multiple of 3or 4" >>output(12)'Multiple of 3 and 4'>>>output(8)'Multiple of 4'>>>output(5)'Not a multiple of 3 or 4
Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future"...
Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Else, if givenYear is 2001 or greater (2001-2100), print "21st century". Else, if givenYear is 1901 or greater (1901-2000), print "20th century". Else (1900 or earlier), print "Long ago". Do NOT end with newline C++
5. Write a C++ statement or statements that will:       Print the first two digits and the  last...
5. Write a C++ statement or statements that will:       Print the first two digits and the  last two digits of any 4 digit number stored in an integer variable n.         For example, given int n = 5623, print 56    23. 6. Write  C++ statements that will align the following three lines as printed in two 20 character columns. Name                                                 Years President Abraham Lincoln                                 1860-1865 Thomas Jefferson                               1801-1809 7.  Write a C++ statement or statements that will Output if a string has a length greater than 10, equal...
The unprecedented Ebola outbreak probably has more virologists thinking about Ebola than ever before. And while...
The unprecedented Ebola outbreak probably has more virologists thinking about Ebola than ever before. And while scientists have learned a lot about this virus since it was discovered almost four decades ago, there's still a lot left to wonder about. Pick an aspect of Ebola and share your research with other students. You may want to research and discuss: 1. What is the reservoir for the Ebola virus? Can it spread to household pets? 2. What cells does it attack...
8a)If Vaughn Ltd. has a margin of safety of $113000, which of the following statements is...
8a)If Vaughn Ltd. has a margin of safety of $113000, which of the following statements is correct? a. Sales can increase by $113000 before Vaughn have an operating loss. b. Sales can increase by $56500, and fixed costs can decrease by $56500 before Vaughn have an operating loss. c. Fixed costs can increase by $113000 before Vaughn have an operating loss. d. Sales can decrease by $56500 and fixed costs can increase by $45200 before Vaughn have an operating loss....
Use LinkedList build-in class (java.util.LinkedList) to write a Java program that has: A. Method to print...
Use LinkedList build-in class (java.util.LinkedList) to write a Java program that has: A. Method to print all elements of a linked list in order. B. Method to print all elements of a linked list in reverse order. C. Method to print all elements of a linked list in order starting from specific position. D. Method to join two linked lists into the first list in the parameters. E. Method to clone a linked list. The copy list has to be...
Write a program names EncryptDecrypt.java that has the following menu choices: Print menu and allow user...
Write a program names EncryptDecrypt.java that has the following menu choices: Print menu and allow user to choose options. The program must have a file dialogue box for text file. Output should be based on user choices. Read in a file Print the file to the console Encrypt the file and write it to the console Write out the encrypted file to a text file Clear the data in memory Read in an encrypted file Decrypt the file Write out...
Which of the following comparison statements is true? Multiple Choice An annuity has equal payments, a...
Which of the following comparison statements is true? Multiple Choice An annuity has equal payments, a perpetuity does not. Both an annuity and a perpetuity have payments with equal values. An annuity covers a longer period of time than a perpetuity. An annuity has a constant rate of return, a perpetuity does not. An annuity has a different rate than a perpetuity.
Please write a few sentences describing a situation where you (or someone you know) has used...
Please write a few sentences describing a situation where you (or someone you know) has used their problem solving or agility skills to increase their human capital in order to get a better job or earn more income.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT