Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribedimage text in transcribed

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 program

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions