Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. METHOD I NEED TO CREATE TO PRINT DETAILS OF ARRAY LIST
  2.  
  3.  
  4. // print cruise details
  5. public void printCruiseDetails() {
  6. int spaceCount;
  7. String spaces = "";
  8. spaceCount = 20 - cruiseName.length();
  9.  
  10. for (int i = 1; i <= spaceCount; i++) {
  11. spaces = spaces + " ";
  12. }
  13.  
  14. System.out.println(cruiseName + spaces + cruiseShipName + "\t" +
  15. departurePort + "\t" + destination + "\t" +
  16. returnPort + "\t\t");
  17. }
  18.  
  19.  
  20.  
  21. CONTENTS OF DRIVER CLASS
  22.  
  23. // instance variables (add more as needed)
  24. private static ArrayList<Ship> shipList = new ArrayList();
  25. private static ArrayList<Cruise> cruiseList = new ArrayList();
  26. private static ArrayList<Passenger> passengerList = new ArrayList();
  27.  
  28.  
  29. public static void main(String[] args) {
  30.  
  31. initializeShipList(); // initial ships
  32. initializeCruiseList(); // initial cruises
  33. initializePassengerList(); // initial passengers
  34.  
  35. // add loop and code here that accepts and validates user input
  36. // and takes the appropriate action. include appropriate
  37. // user feedback and redisplay the menu as needed
  38.  
  39.  
  40. }
  41.  
  42. // hardcoded ship data for testing
  43. // Initialize ship list
  44. public static void initializeShipList() {
  45. add("Candy Cane", 20, 40, 10, 60, true);
  46. add("Peppermint Stick", 10, 20, 5, 40, true);
  47. add("Bon Bon", 12, 18, 2, 24, false);
  48. add("Candy Corn", 12, 18, 2, 24, false);
  49. }
  50.  
  51. // hardcoded cruise data for testing
  52. // Initialize cruise list
  53. public static void initializeCruiseList() {
  54. Cruise newCruise = new Cruise("Southern Swirl", "Candy Cane", "Miami", "Cuba", "Miami");
  55. cruiseList.add(newCruise);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement