SlideShare a Scribd company logo
import java.util.LinkedList;
import java.util.Scanner;
public class Agency {
private Administrator loggedInUser;
private Destinations destinations;
private Flights flights;
private Administrators admins;
public Agency() {
admins = new Administrators();
admins.insertDummyData();
destinations = new Destinations(this);
flights = new Flights(this);
}
public Destinations getDestinations() {
return destinations;
}
public Flights getFlights() {
return flights;
}
public void login() {
Scanner scanner = new Scanner(System.in);
boolean loggedIn = false;
while (!loggedIn) {
System.out.print("Username: ");
String username = scanner.nextLine();
System.out.print("Password: ");
String password = scanner.nextLine();
if (admins.validateCredentials(username, password)) {
loggedIn = true;
loggedInUser = new Administrator(admins.getAdminName(username), username,
password);
mainMenu(scanner);
} else {
System.out.println("Invalid Credentials! Try Again.");
}
}
}
public void destinationsMenu(Scanner scanner) {
System.out.println("Welcome to the Destinations section " + loggedInUser.getName() + ",
Please make a selection from the menu:");
while (true) {
System.out.println("1. View All Destinations");
System.out.println("2. View Destinations by Country");
System.out.println("3. Add a Destination");
System.out.println("4. Remove a Destination");
System.out.println("X. Return to Main Menu");
System.out.print("Please enter an option: ");
String option = scanner.nextLine();
switch (option) {
case "1":
destinations.displayAllDestinations();
break;
case "2":
break;
case "3":
break;
case "4":
break;
case "X":
mainMenu(scanner);
return;
default:
System.out.println("Please enter a valid choice, or press X to exit.");
}
}
}
public void mainMenu(Scanner scanner) {
System.out.println("Welcome to the Prog2 Travel Agency " + loggedInUser.getName() + ",
Please make a selection from the menu:");
while (true) {
System.out.println("1. Explore Flights");
System.out.println("2. Explore Destinations");
System.out.println("3. Book a Trip");
System.out.println("X. Exit the System");
System.out.print("Please enter an option: ");
String option = scanner.nextLine();
switch (option) {
case "1":
break;
case "2":
destinationsMenu(scanner);
break;
case "3":
break;
case "X":
System.out.println("Thanks for using the Prog2 Travel Agency.");
System.exit(0);
default:
System.out.println("Please enter a valid choice, or press X to exit.");
}
}
}
public static void main(String[] args) {
Agency agency = new Agency();
agency.login();
}
}
public class Destination {
private String country;
private String name;
public Destination(String name, String country) {
this.name = name;
this.country = country;
}
public String getCountry() {
return country;
}
public String getName() {
return name;
}
}
import java.util.LinkedList;
public class Destinations {
private LinkedList destinations;
private Agency agency;
public Destinations(Agency agency) {
this.agency = agency;
destinations = new LinkedList<>();
destinations.add(new Destination("Eiffel Tower", "France"));
destinations.add(new Destination("Opera House", "Australia"));
destinations.add(new Destination("Uluru", "Australia"));
destinations.add(new Destination("Machu Picchu", "Peru"));
destinations.add(new Destination("Great Pyramids", "Egypt"));
destinations.add(new Destination("Niagara Falls", "Canada"));
}
public LinkedList getAllDestinations() {
return destinations;
}
public LinkedList getDestinationsByCountry(String country) {
LinkedList result = new LinkedList<>();
for (Destination dest : destinations) {
if (dest.getCountry().equalsIgnoreCase(country)) {
result.add(dest);
}
}
return result;
}
public void displayAllDestinations() {
System.out.println("+----------------------+----------------+--------------+-------+-------+");
System.out.println("| Destinations |");
System.out.println("+----------------------+----------------+--------------+-------+-------+");
for (Destination destination : destinations) {
System.out.println(destination.getName() + " in " + destination.getCountry());
}
System.out.println("+----------------------+----------------+--------------+-------+-------+");
}
the login works i need help using the untils to header and footer and also with the test case
above.
Username: david46@uts.com Password: 123 Welcome to the Prog2 Travel Agency David Dyer,
Please make a selection from the menu: 1. Explore Flights 2. Explore Destinations 3. Book a
Trip X. Exit the System Please enter an option: 2 Welcome to the Destinations section David
Dyer, Please make a selection from the menu: 1. View All Destinations 2. View Destinations by
Country 3. Add a Destination 4. Remove a Destination X. Return to Main Menu Please enter an
option: 2 Country: sdfdfs No matching destinations found. Country: australia No matching
destinations found. Country: Australia Destinations Opera House in Australia Uluru in Australia
1. View All Destinations 2. View Destinations by Country 3. Add a Destination 4. Remove a
Destination X. Return to Main Menu Please enter an option: X Welcome to the Prog2 Travel
Agency David Dyer, Please make a selection from the menu: 1. Explore Flights 2. Explore
Destinations 3. Book a Trip X. Exit the System Please enter an option: X Thanks for using the
Prog2 Travel Agency.

More Related Content

Similar to import java.util.LinkedList;import java.util.Scanner;public cla.pdf

Anti patterns
Anti patternsAnti patterns
Anti patterns
Alex Tumanoff
 
Why Sifu?
Why Sifu?Why Sifu?
Why Sifu?
Sifu
 
Why Sifu
Why SifuWhy Sifu
Why Sifu
LambdaWorks
 
Need help finding the error in my code. Wherever theres a player.pdf
Need help finding the error in my code. Wherever theres a player.pdfNeed help finding the error in my code. Wherever theres a player.pdf
Need help finding the error in my code. Wherever theres a player.pdf
arihanthtoysandgifts
 
PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2
eugenio pombi
 
Cnam azure 2014 mobile services
Cnam azure 2014   mobile servicesCnam azure 2014   mobile services
Cnam azure 2014 mobile services
Aymeric Weinbach
 
Creating a Facebook Clone - Part XLV.pdf
Creating a Facebook Clone - Part XLV.pdfCreating a Facebook Clone - Part XLV.pdf
Creating a Facebook Clone - Part XLV.pdf
ShaiAlmog1
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
Samuel ROZE
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
forwardcom41
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
Visual Engineering
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
Ryan Anklam
 
Creating a Facebook Clone - Part XLV - Transcript.pdf
Creating a Facebook Clone - Part XLV - Transcript.pdfCreating a Facebook Clone - Part XLV - Transcript.pdf
Creating a Facebook Clone - Part XLV - Transcript.pdf
ShaiAlmog1
 
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdfImplement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
kostikjaylonshaewe47
 
Java Programs
Java ProgramsJava Programs
Java Programs
Seetharamaiah Vadde
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
Ganesh Samarthyam
 
C# programs
C# programsC# programs
C# programs
Gourav Pant
 
Java programs
Java programsJava programs
Java programs
jojeph
 
Martin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick ReferenceMartin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick Reference
Seung-Bum Lee
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
Sergi Subirats Cugat
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented Architecture
Luiz Messias
 

Similar to import java.util.LinkedList;import java.util.Scanner;public cla.pdf (20)

Anti patterns
Anti patternsAnti patterns
Anti patterns
 
Why Sifu?
Why Sifu?Why Sifu?
Why Sifu?
 
Why Sifu
Why SifuWhy Sifu
Why Sifu
 
Need help finding the error in my code. Wherever theres a player.pdf
Need help finding the error in my code. Wherever theres a player.pdfNeed help finding the error in my code. Wherever theres a player.pdf
Need help finding the error in my code. Wherever theres a player.pdf
 
PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2
 
Cnam azure 2014 mobile services
Cnam azure 2014   mobile servicesCnam azure 2014   mobile services
Cnam azure 2014 mobile services
 
Creating a Facebook Clone - Part XLV.pdf
Creating a Facebook Clone - Part XLV.pdfCreating a Facebook Clone - Part XLV.pdf
Creating a Facebook Clone - Part XLV.pdf
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
 
Creating a Facebook Clone - Part XLV - Transcript.pdf
Creating a Facebook Clone - Part XLV - Transcript.pdfCreating a Facebook Clone - Part XLV - Transcript.pdf
Creating a Facebook Clone - Part XLV - Transcript.pdf
 
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdfImplement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
C# programs
C# programsC# programs
C# programs
 
Java programs
Java programsJava programs
Java programs
 
Martin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick ReferenceMartin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick Reference
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented Architecture
 

Recently uploaded

Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 

Recently uploaded (20)

Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 

import java.util.LinkedList;import java.util.Scanner;public cla.pdf

  • 1. import java.util.LinkedList; import java.util.Scanner; public class Agency { private Administrator loggedInUser; private Destinations destinations; private Flights flights; private Administrators admins; public Agency() { admins = new Administrators(); admins.insertDummyData(); destinations = new Destinations(this); flights = new Flights(this); } public Destinations getDestinations() { return destinations; } public Flights getFlights() { return flights; } public void login() { Scanner scanner = new Scanner(System.in); boolean loggedIn = false; while (!loggedIn) { System.out.print("Username: "); String username = scanner.nextLine(); System.out.print("Password: "); String password = scanner.nextLine(); if (admins.validateCredentials(username, password)) { loggedIn = true; loggedInUser = new Administrator(admins.getAdminName(username), username, password); mainMenu(scanner); } else { System.out.println("Invalid Credentials! Try Again."); }
  • 2. } } public void destinationsMenu(Scanner scanner) { System.out.println("Welcome to the Destinations section " + loggedInUser.getName() + ", Please make a selection from the menu:"); while (true) { System.out.println("1. View All Destinations"); System.out.println("2. View Destinations by Country"); System.out.println("3. Add a Destination"); System.out.println("4. Remove a Destination"); System.out.println("X. Return to Main Menu"); System.out.print("Please enter an option: "); String option = scanner.nextLine(); switch (option) { case "1": destinations.displayAllDestinations(); break; case "2": break; case "3": break; case "4": break; case "X": mainMenu(scanner); return; default: System.out.println("Please enter a valid choice, or press X to exit."); } } } public void mainMenu(Scanner scanner) { System.out.println("Welcome to the Prog2 Travel Agency " + loggedInUser.getName() + ", Please make a selection from the menu:"); while (true) { System.out.println("1. Explore Flights");
  • 3. System.out.println("2. Explore Destinations"); System.out.println("3. Book a Trip"); System.out.println("X. Exit the System"); System.out.print("Please enter an option: "); String option = scanner.nextLine(); switch (option) { case "1": break; case "2": destinationsMenu(scanner); break; case "3": break; case "X": System.out.println("Thanks for using the Prog2 Travel Agency."); System.exit(0); default: System.out.println("Please enter a valid choice, or press X to exit."); } } } public static void main(String[] args) { Agency agency = new Agency(); agency.login(); } } public class Destination { private String country; private String name; public Destination(String name, String country) { this.name = name; this.country = country; } public String getCountry() { return country;
  • 4. } public String getName() { return name; } } import java.util.LinkedList; public class Destinations { private LinkedList destinations; private Agency agency; public Destinations(Agency agency) { this.agency = agency; destinations = new LinkedList<>(); destinations.add(new Destination("Eiffel Tower", "France")); destinations.add(new Destination("Opera House", "Australia")); destinations.add(new Destination("Uluru", "Australia")); destinations.add(new Destination("Machu Picchu", "Peru")); destinations.add(new Destination("Great Pyramids", "Egypt")); destinations.add(new Destination("Niagara Falls", "Canada")); } public LinkedList getAllDestinations() { return destinations; } public LinkedList getDestinationsByCountry(String country) { LinkedList result = new LinkedList<>(); for (Destination dest : destinations) { if (dest.getCountry().equalsIgnoreCase(country)) { result.add(dest); } } return result; } public void displayAllDestinations() { System.out.println("+----------------------+----------------+--------------+-------+-------+"); System.out.println("| Destinations |"); System.out.println("+----------------------+----------------+--------------+-------+-------+");
  • 5. for (Destination destination : destinations) { System.out.println(destination.getName() + " in " + destination.getCountry()); } System.out.println("+----------------------+----------------+--------------+-------+-------+"); } the login works i need help using the untils to header and footer and also with the test case above. Username: david46@uts.com Password: 123 Welcome to the Prog2 Travel Agency David Dyer, Please make a selection from the menu: 1. Explore Flights 2. Explore Destinations 3. Book a Trip X. Exit the System Please enter an option: 2 Welcome to the Destinations section David Dyer, Please make a selection from the menu: 1. View All Destinations 2. View Destinations by Country 3. Add a Destination 4. Remove a Destination X. Return to Main Menu Please enter an option: 2 Country: sdfdfs No matching destinations found. Country: australia No matching destinations found. Country: Australia Destinations Opera House in Australia Uluru in Australia 1. View All Destinations 2. View Destinations by Country 3. Add a Destination 4. Remove a Destination X. Return to Main Menu Please enter an option: X Welcome to the Prog2 Travel Agency David Dyer, Please make a selection from the menu: 1. Explore Flights 2. Explore Destinations 3. Book a Trip X. Exit the System Please enter an option: X Thanks for using the Prog2 Travel Agency.