Write program in java without using public static void travelToFuture

Objective: To build a time-traveling program that allows users to travel forward or backward in time in fixed intervals.
Problem statement: You are to create a "Time Machine" simulator. Users can select if they want to travel into the future or the past, and then specify the number of years they want to travel.
Requirements:
Use a for loop to count the years as they pass by
Provide an engaging narrative for the time-travel experience(describe what the world looks like in different eras).
Sample output:
Welcome to the Time Machine!
Would you like to travel to the future or the past? (Enter 'future' or 'past'): future
How many years would you like to travel into the future? 3
Traveling to the future...
Year 1: Electric cars are now the standard.
Year 2: AI-powered robots are common in households.
Year 3: Space tourism has become affordable.
Welcome to the year 2026! Enjoy your stay!

import java.util.Scanner;

public class TimeMachine {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.println("Welcome to the Time Machine!");
System.out.print("Would you like to travel to the future or the past? (Enter 'future' or 'past'): ");
String timeTravel = scanner.nextLine();

System.out.print("How many years would you like to travel? ");
int years = scanner.nextInt();

System.out.println("Traveling " + timeTravel + "...");

if (timeTravel.equalsIgnoreCase("future")) {
travelToFuture(years);
} else if (timeTravel.equalsIgnoreCase("past")) {
travelToPast(years);
}
}

public static void travelToFuture(int years) {
for (int i = 1; i <= years; i++) {
switch (i) {
case 1:
System.out.println("Year " + i + ": Electric cars are now the standard.");
break;
case 2:
System.out.println("Year " + i + ": AI-powered robots are common in households.");
break;
case 3:
System.out.println("Year " + i + ": Space tourism has become affordable.");
break;
default:
System.out.println("Year " + i + ": The future is looking bright!");
break;
}
}
System.out.println("Welcome to the year " + (2021 + years) + "! Enjoy your stay!");
}

public static void travelToPast(int years) {
for (int i = 1; i <= years; i++) {
switch (i) {
case 1:
System.out.println("Year " + i + ": Horse-drawn carriages dominate the streets.");
break;
case 2:
System.out.println("Year " + i + ": Industrial revolution is in full swing.");
break;
case 3:
System.out.println("Year " + i + ": Exploration of new lands is at its peak.");
break;
default:
System.out.println("Year " + i + ": The past is a fascinating place!");
break;
}
}
System.out.println("Welcome to the year " + (2021 - years) + "! Enjoy your stay!");
}
}