Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 2 : 1. Modify the program to read user input for carYears 2. Write multiple

ID: 3827695 • Letter: P

Question

Part 2 :

1.   Modify the program to read user input for carYears
2.   Write multiple if statements.
If carYear is 1969 or earlier, print "Probably has few safety features."
If 1970 or higher, print "Probably has seat belts."
If 1990 or higher, print "Probably has anti-lock brakes."
If 2000 or higher, print "Probably has air bags."

3.   End each “phrase” with period and move the cursor to a newline.

Ex: carYear = 1995 prints:
Probably has seat belts.
Probably has anti-lock brakes.

import java.util.Scanner;

public class CarFeatures {
public static void main (String [] args) {
int carYear = 0;

carYear = 1940;

/* Your solution goes here */

return;
}
}

Explanation / Answer

HI, Please find my implementation.

Please let me know in case of any issue.

import java.util.Scanner;

public class CarFeatures {

   public static void main (String [] args) {

      

       Scanner sc = new Scanner(System.in);

      

       int carYear = 0;

       System.out.print("Entet carYear = ");

       carYear = sc.nextInt();

      

       if(carYear >= 2000)

           System.out.println("Probably has air bags.");

       else if(carYear >= 1990)

           System.out.println("Probably has anti-lock brakes.");

       else if(carYear >= 1970)

           System.out.println("Probably has seat belts.");

       else

           System.out.println("Probably has few safety features.");

      

       return;

   }

}

/*

Sample run:

Entet carYear = 1995

Probably has anti-lock brakes.

*/