Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**In JAVA, please. **I need help. I have the code but for some reason, it doesn't generate the code that I need. I have an

**In JAVA, please.

**I need help. I have the code but for some reason, it doesn't generate the code that I need. I have an example of the comparison on my output and the expected output for your perusal. If you can help that would be great.

Write multiple if statements:

If carYear is before 1967, print "Probably has few safety features." (without quotes).

If after 1971, print "Probably has seat belts.". I

f after 1991, print "Probably has anti-lock brakes.".

If after 2001, print "Probably has tire-pressure monitor.".

End each phrase with period and newline. Ex: carYear = 1995 prints:

Probably has seat belts. Probably has anti-lock brakes.

**My code:

if (carYear<1967) { System.out.println("Probably has few safety features."); } if (carYear>1971) { System.out.println("Probably has seat belts."); } if (carYear>1991) { System.out.println("Probably has anti-lock brakes."); } if (carYear>2001) { System.out.println("Probably has tire-pressure monitor."); }

**My output comparison

Output differs. See highlights below. Special character legend

Input

1966

Your output:

Probably has seat belts.

Probably has anti-lock brakes.

Expected output:

Probably has few safety features.

2: Compare output

keyboard_arrow_up

Output differs. See highlights below.

Input

1967

Your output:

Probably has seat belts. Probably has anti-lock brakes.

Expected output:

Solution expected no output

3: Compare output

keyboard_arrow_up

Output differs. See highlights below.

Input

1971

Your output:

Probably has seat belts. Probably has anti-lock brakes.

Expected output:

Solution expected no output

4: Compare output

keyboard_arrow_up

Output differs. See highlights below. Special character legend

Input

1972

Your output:

Probably has seat belts. Probably has anti-lock brakes.

Expected output:

Probably has seat belts.

5: Compare output

keyboard_arrow_up

Output differs. See highlights below. Special character legend

Input

1991

Your output:

Probably has seat belts. Probably has anti-lock brakes.

Expected output:

Probably has seat belts.

6: Compare output

keyboard_arrow_up

Input

1992

Your output

Probably has seat belts. Probably has anti-lock brakes.

7: Compare output

keyboard_arrow_up

Input

2001

Your output

Probably has seat belts. Probably has anti-lock brakes.

8: Compare output

keyboard_arrow_up

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

Identify and control your anxieties

Answered: 1 week ago

Question

Understanding and Addressing Anxiety

Answered: 1 week ago