1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bas_tet [7]
3 years ago
5

Write multiple if statements

Engineering
1 answer:
Tatiana [17]3 years ago
3 0

Code:

#include <iostream>

using namespace std;

int main()

{

  int Car_Year;

  cout<<"Please Enter the Car Model."<<endl;

  cin>>Car_Year;    

 if (Car_Year<1967)

 {

cout<<"Few safety features."<<endl;

 }

else if (Car_Year>1971 && Car_Year<=1991)

{

cout<<"Probably has head rests."<<endl;

}

else if (Car_Year>1991 && Car_Year<=2000)

{

cout<<"Probably has antilock brakes."<<endl;

}

else if (Car_Year>2000)

{

cout<<"Probably has airbags."<<endl;

  }

else

{

cout<<"Invalid Selection."<<endl;

}

  return 0;

}

Output:

Please Enter the Car Model.

1975

Probably has head rests.

Please Enter the Car Model.

1999

Probably has antilock brakes.

Please Enter the Car Model.

2005

Probably has airbags.

Please Enter the Car Model.

1955

Few safety features.

Explanation:

We were required to implement multiple If else conditions to assign car model year with the corresponding features of the car.

The code is tested with a wide range of inputs and it returned the same results as it was asked in the question.

You might be interested in
5. Create a function named second_a that uses a list comprehension. The function will take a single integer parameter n. Find ev
Mekhanik [1.2K]

Answer:

//Program was implemented using C++ Programming Language

// Comments are used for explanatory purpose

#include<iostream>

using namespace std;

unsigned int second_a(unsigned int n)

{

int r,sum=0,temp;

int first;

for(int i= 1; I<=n; i++)

{

first = n;

//Check if first digit is 3

// Remove last digit from number till only one digit is left

while(first >= 10)

{

first = first / 10;

}

if(first == 3) // if first digit is 3

{

//Check if n is palindrome

temp=n; // save the value of n in a temporary Variable

while(n>0)

{

r=n%10; //getting remainder

sum=(sum*10)+r;

n=n/10;

}

if(temp==sum)

cout<<n<<" is a palindrome";

else

cout<<n<<" is not a palindrome";

}

}

}

Explanation:

The above code segments is a functional program that checks if a number that starts with digit 3 is Palindromic or not.

The program was coded using C++ programming language.

The main method of the program is omitted.

Comments were used for explanatory purpose.

8 0
3 years ago
The function below takes a single parameter, a list of numbers called number_list. Complete the function to return a string of t
makkiz [27]

Answer:

The solution code is written in Python:

  1. def convertCSV(number_list):
  2.    str_list = []
  3.    for num in number_list:
  4.        str_list.append(str(num))
  5.    
  6.    return ",".join(str_list)
  7. result = convertCSV([22,33,44])
  8. print(result)

Explanation:

Firstly, create a function "convertCSV" with one parameter "number_list". (Line 1)

Next, create an empty list and assign it to a new variable <em>str_list</em>. (Line 2)

Use for-loop to iterate through all the number in the <em>number_list</em>.(Line 4). Within the loop, each number is converted to a string using the Python built-in function <em>str() </em>and then use the list append method to add the string version of the number to <em>str_list</em>.

Use Python string<em> join() </em>method to join all the elements in the str_list as a single string. The "," is used as a separator between the elements (Line 7) . At the end return the string as an output.

We can test the function by calling the function and passing [22,33,34] as an argument and we shall see "22,33,44" is printed as an output. (Line 9 - 10)

6 0
3 years ago
In which situation is a are food service workers not required to wash their hands?
Margarita [4]

Answer:

when wearing gloves?

Explanation:

?

or when off duty

3 0
3 years ago
Read 2 more answers
For a turning operation, you have selected a high-speed steel (HSS) tool and turning a hot rolled free machining steel. Your dep
Alisiya [41]

Answer:

MRR = 1.984

Explanation:

Given that                              

Depth of cut ,d=0.105 in

Diameter D= 1 in

Speed V= 105 sfpm

feed f= 0.015 ipr

Now  the metal   removal  rate   given as

MRR= 12 f V d

d= depth of cut

V= Speed

f=Feed

MRR= Metal removal rate

By putting the values

MRR= 12 f V d

MRR = 12 x 0.015 x 105 x 0.105

MRR = 1.984

Therefore answer is -

1.944

8 0
3 years ago
What is capillary action?
BARSIC [14]
Capillary action occurs When the adhesion to the walls stronger than dirt cohesive forces between a liquid molecules. the head towards Capillery action will take water in a uniform circular is limited by surface tension and, of course, gravity.
4 0
2 years ago
Other questions:
  • Use the convolutional integral to find the response of an LTI system with impulse response ℎ(????) and input x(????). Sketch the
    8·1 answer
  • Make a proposal to add a small pizza shop to a historical part of town. How could it be designed to “fit” into the area?
    7·2 answers
  • Transcription machinery assembles at _______________.
    6·1 answer
  • An extruder barrel has a diameter of 4.22 inches and a length of 75 inches. The screw rotates at 65 revolutions per minute. The
    14·1 answer
  • Consider a 0.15-mm-diameter air bubble in a liquid. Determine the pressure difference between the inside and outside of the air
    10·1 answer
  • An engineer measures a sample of 1200 shafts out of a certain shipment. He finds the shafts have an average diameter of 2.45 inc
    15·1 answer
  • Consider a single crystal of nickel oriented such that a tensile stress is applied along a [001] direction. If slip occurs on a
    6·1 answer
  • For two different air velocities, the Nusselt number for two different diameter cylinders in cross flow is the same. The average
    6·1 answer
  • A step-up transformer has 20 primary turns and 400 secondary turns. If the primary current is 30 A, what is the secondary curren
    15·1 answer
  • Moonbeam-Musel (MM), a manufacturer of small appliances, has a large injection molding department. Because MM's CEO, Crosscut Sa
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!