answer.
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
nevsk [136]
2 years ago
12

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 Probably has seat belts. Probably has antilock brakes.
Computers and Technology
1 answer:
Kazeer [188]2 years ago
3 0

Answer:

<em>import java.util.Scanner;</em>

<em>public class Hggg {</em>

<em>        public static void main (String [] args) {</em>

<em>            System.out.println("Enter the car make year");</em>

<em>            Scanner in = new Scanner(System.in);</em>

<em>            int car_year = in.nextInt();</em>

<em>            if (car_year<1969){</em>

<em>             System.out.println("Few safety features.");</em>

<em>            }</em>

<em>            else if (car_year>=1970 && car_year<1990){</em>

<em>                System.out.println("Probably has seat belts.");</em>

<em>            }</em>

<em>            else if (car_year>=1990 && car_year<2000){</em>

<em>                System.out.println("Probably has seat belts.");</em>

<em>                System.out.println("Probably has antilock brakes.");</em>

<em>            }</em>

<em>            else if (car_year>=2000){</em>

<em>                System.out.println("Probably has seat belts.");</em>

<em>                System.out.println("Probably has antilock brakes.");</em>

<em>                System.out.println("Probably has airbags.");</em>

<em>            }</em>

<em>        }</em>

<em>    }</em>

Explanation:

In this solution, multiple if statements have been used to accomplish each step. Observe that there are more than one print statements when year is greater than 1990 because the condition applied to year greater than 1970 holds true for every year greater than 1970 (1990, 2000 etc)

You might be interested in
Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts t
zimovet [89]

Answer:

Check the explanation

Explanation:

x, y, z = "abc", "15", "boo"

errors = []

try:

   x = int(x)

except ValueError:

   errors.append('x')

try:

   y = int(y)

except ValueError:

   errors.append('y')

try:

   z = int(z)

except ValueError:

   errors.append('z')

if len(errors) == 0:

   print(x+y+z)

else:

   print('bad value(s) in: ' + ' '.join(errors))

5 0
2 years ago
Read 2 more answers
What is a typical grace period for a credit card...
Schach [20]
It is 20 to 25 days so c is correct
6 0
2 years ago
Read 2 more answers
Match each scenario to the absolute value expression that describes it. 1. the distance moved when going backwards five spaces i
soldi70 [24.7K]

Answer:

i don tunderstand the question

Explanation:

4 0
2 years ago
Read 2 more answers
Juan, a network user, sends an email to you, the IT admin of the network, stating that his account is locked because he has lost
slamgirl [31]

Answer:

The correct answer to the following question is Option D.

Explanation:

Already when we authorize an individual to set up a new credential or provide a provisional code or password, we must make ensure that the person is checked. We could allow a verification code after confirming the consumer.

  • Verification remains crucial because an imposter may try to compromise to provide a temporary credential or switch his password by posing as a further person.
  • So, Juan fixes his problem by making sure whether resetting the password has always been allowed by checking that Juan is the one that he claims he is.

8 0
2 years ago
Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the printAll() member method and a separate println()
vekshin1

Answer:

Following are the program in the java language  

public class Main // Main class  

{

   String courseStudentsname; // variable declaration  

   int age; // variable declaration  

   int ID; // variable declaration  

   Main() // default constructor

   {

courseStudentsname="Smith";//assign the values mention in the question              

       age=20;//assign the values which is mention in the question  

       ID=9999;//assign the values which is mention in the question    

   }

void printAll() // method definition of printAll()  

   {

      System.out.print("Name: " + courseStudentsname ); // display name

      System.out.print(", Age: " + age); // display age

      System.out.print(", ID: " + ID); // display id

   }

public static void main(String[] args) // main fuunction()

{

Main ob=new Main(); // create the object of Main class  

ob.printAll(); // calling the method printAll()

}

}

Output:

Name:"Smith, Age:20, ID:9999

Explanation:

Following are the description of program

  • Create a constructor of "Main" class and store the respective values of courseStudentsname,age and ID in that constructor .
  • create a method printAll() and print the respective values in the given format which is mention in the question by using   System.out.print method.
  • In the main function create an object of "Main" class i.e "ob".
  • Finally, call the printAll() method by using the object of Main class.

4 0
2 years ago
Other questions:
  • which of these paste options is commonly available from the paste options button? A&gt; use the destination them. B. keep the em
    14·2 answers
  • Static packet filtering firewalls are limited to ________. inspecting packets for which there are good application proxy filteri
    8·1 answer
  • Explain how buyers and sellers factor into setting the stock price for a company’s shares.
    13·1 answer
  • Question 1 :Which type of unshielded twisted pair (UTP) cable is commonly used for 1000BASE-T Ethernet networks and is often mad
    8·1 answer
  • 2 Name the package that contains scanner class?​
    10·1 answer
  • External network security threats can include management failure to support organization-wide security awareness, inadequate sec
    12·1 answer
  • Which of the following is true of how the Internet has responded to the increasing number of devices now using the network? a) T
    12·2 answers
  • Accenture has partnered with a global construction company that specializes in building skyscrapers. The company wants better ma
    12·1 answer
  • Choose the response that best completes the following statement.
    14·2 answers
  • A retailer is able to track which products draw the most attention from its customers through the use of 5g-enabled motion senso
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!