Answer:
import java.util.Scanner;
public class Car {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a year");
int year = in.nextInt();
if(year<=1900){
System.out.println("Long ago");
}
else if(year >=1901&& year < 2001){
System.out.println("20th Century");
}
else if(year> 2001 && year<2101 ){
System.out.println("21st Century");
}
else{
System.out.println("Distant Future");
}
}
}
Step-by-step explanation:
- This is implemented in Java programming
- First the Scanner class is used to receive user input for year and stored in the variable year
- Using if...else statements, we start from year less that 1900 (Long ago), else if year is equal to or greater than 1901 but less that 2001 (20th century); else if year is between 2001 and 2101 (21st Century) Else (Distant future)