Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- METHOD I NEED TO CREATE TO PRINT DETAILS OF ARRAY LIST
- // print cruise details
- public void printCruiseDetails() {
- int spaceCount;
- String spaces = "";
- spaceCount = 20 - cruiseName.length();
- for (int i = 1; i <= spaceCount; i++) {
- spaces = spaces + " ";
- }
- System.out.println(cruiseName + spaces + cruiseShipName + "\t" +
- departurePort + "\t" + destination + "\t" +
- returnPort + "\t\t");
- }
- CONTENTS OF DRIVER CLASS
- // instance variables (add more as needed)
- private static ArrayList<Ship> shipList = new ArrayList();
- private static ArrayList<Cruise> cruiseList = new ArrayList();
- private static ArrayList<Passenger> passengerList = new ArrayList();
- public static void main(String[] args) {
- initializeShipList(); // initial ships
- initializeCruiseList(); // initial cruises
- initializePassengerList(); // initial passengers
- // add loop and code here that accepts and validates user input
- // and takes the appropriate action. include appropriate
- // user feedback and redisplay the menu as needed
- }
- // hardcoded ship data for testing
- // Initialize ship list
- public static void initializeShipList() {
- add("Candy Cane", 20, 40, 10, 60, true);
- add("Peppermint Stick", 10, 20, 5, 40, true);
- add("Bon Bon", 12, 18, 2, 24, false);
- add("Candy Corn", 12, 18, 2, 24, false);
- }
- // hardcoded cruise data for testing
- // Initialize cruise list
- public static void initializeCruiseList() {
- Cruise newCruise = new Cruise("Southern Swirl", "Candy Cane", "Miami", "Cuba", "Miami");
- cruiseList.add(newCruise);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement