Question
Java: Please help with my following code. I am trying to get the following result, but cannot figure out my loop. Or if you see
Java: Please help with my following code. I am trying to get the following result, but cannot figure out my loop. Or if you see a better way, please show me. thank you.
Output I am aiming for:
Code I have so far:
public class SpaceShipTester {
//private static final Object Object = null;
public static void main(String[] args) {
Traveler t1= new Traveler();
t1.setId();
t1.setName("Naomi");
t1.setCurrent(Location.EARTH);
System.out.println("Traveler " + t1.getID() + " "+ t1);
Traveler t2 = new Traveler("Klaes", Location.MARS);
System.out.println("Traveler " + t2.getID() + " "+t2);
Traveler t3 = new Traveler("Lucinda", Location.MOON);
System.out.println("Traveler " + t3.getID() + " "+t3);
Traveler t4 = new Traveler("Amos", Location.MARS);
System.out.println("Traveler " + t4.getID() + " "+t4);
System.out.println(" ");
//for(int i = 1; i
// System.out.println("Date for Traveler " + t1.getID());
// if(t1.equals(Object))
// System.out.println("Name: " + t1.getName());
// if(t1.equals(Object))
// System.out.println("Current: " + t1.getCurrent());
// if(t1.equals(Object))
// System.out.println("Traveler " + t1.getID());
// System.out.println(t1);
for(int i = 1; i
System.out.println("Date for Traveler " + t1.getID());
System.out.println("Name: " + t1.getName());
System.out.println("Current: " + t1.getCurrent());
System.out.println("Traveler " + t1.getID() + " " + t1);
System.out.println(" ");
}
}
}
SpaceShipTester class with a main method: A text-based driver program that performs the following steps: a. It asks for four Travelers and two StarShips (Part 1, below) b. It executes a text-menu with the following options (Parts 2-4 below) 1. Add traveler to a Spaceship 1. Search for traveler on a Spaceship 11. Move a spaceship to a new location . Exit the programStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started