Adavanced project report 1
Adavanced project report 1
Project report
Group members :
• Abdelrahman Khaled alkawwa ( 21p0285)
Each client has his personal information plus information about trips he has.
- Client’s trips can be divided into previous trips, current trip (if he is in a trip now),
and coming trips (trips that doesn’t start yet).
-
This application should enable the employee to:
▪ Add, edit, or cancel any tours or trips organized by the company.
▪ Add, edit, delete, and view tour guide information.
▪ Assign each tour guide to specified tour based on his availability.
▪ Add, edit, delete, and view personal details of clients.
▪ Cancel client’s coming trip if the client wants that.
▪ Postpone a client’s trip if there is another trip to the same site that will take
place soon.
▪ Calculate the total profit for each category of trips separately.
▪ Finally, he can get the total profit of all trip categories.
UML diagram :
Our classes :
1. Client
2. Tour
3. Tourguide
4. Travelagency (abstract)
5. Date
6. Project
1) Attributes :
2) Methods
• Setters/getters : used to access private elements
• Abstract methods : used to act as a blueprint to all child
classes that extend this class
1) Attributes :
2) Methods used :
1)Attributes
Methods used :
• Constructors : used to initialize the values
• Setters/getters : used to access private elements
Edit --- method:
Attributes :
Methods:
• The editSites() method first finds the tour by its ID. If the
tour is found, then the sites of the tour are updated.
• The editPrice() method first finds the tour by its ID. If the
tour is found, then the price of the tour is updated.
•
• The editProfit() method first finds the tour by its ID. If the
tour is found, then the profit of the tour is updated.
Canceltour: This method first finds the tour by its ID. If the tour
is found, then the tour is removed from the list of tours.
addClients: the method first finds the client and the tour by
their IDs. If the client and the tour are found, then the client is
added to the list of clients for the tour and the tour is added to
the list of upcoming tours for the client.
• Date class
Methods :
Constructor :
Getters:
CheckIfUpcomingDate:
This method first compares the year, month, and day of the current date
and the specified date.
If the year of the specified date is less than the year of the current date,
then the specified date is not upcoming.
If the years are equal, then the method compares the months of the two
dates.
If the month of the specified date is less than the month of the current
date, then the specified date is not upcoming.
If the months are equal, then the method compares the days of the two
dates.
If the day of the specified date is less than the day of the current date, then
the specified date is not upcoming. Otherwise, the specified date is
upcoming .The method returns 0 if the specified date is upcoming and -1 if
the specified date is not upcoming.
Our main method :
tour.addTour(tour);
System.out.println("Please enter the tour's
information");
System.out.println("Id");
tour.setT_Id(input.nextInt());
System.out.println("Date in this format
DDMMYYY only numbers!!");
tour.setT_Date(input.nextInt());
System.out.println("Category");
System.out.println("Press 1 for Safari holidays
\nPress 2 for Adventure tour \nPress 3 for Culture trip \nPress 4
for Religious tour \n");
int thirdChoice = input.nextInt();
while (thirdChoice > 4 || thirdChoice < 1){
System.out.println("Please enter a number
from what's mentioned above");
thirdChoice = input.nextInt();
}
switch(thirdChoice){
case 1 -> tour.setT_Category("Safari
holidays");
case 2 -> tour.setT_Category("Adventure
tour");
case 3 -> tour.setT_Category("Culture trip");
case 4 -> tour.setT_Category("Religious
tour");
}
System.out.println("Name");
tour.setT_Name(input.next());
System.out.println("Max number of clients");
tour.setT_maxClients(input.nextInt());
System.out.println("Sites");
tour.setT_sites(input.next());
System.out.println("Price");
tour.setT_price(input.nextInt());
System.out.println("If you want to add
another thing press 0 if not press 1");
countAddTour = input.nextInt();
}
}
case 2 -> {
int countTourEdit = 0;
while(countTourEdit == 0){
System.out.println("Enter Tour Id");
int id = input.nextInt();
tour = tour.findTourById(id);
System.out.println("What do you want to edit
:");
System.out.println("Press 1 to edit name, Id
and Max Clients \nPress 2 to edit Date , Category and Tour Guide
\nPress 3 to edit Sites , Price and Profit\n");
int fourthChoice = input.nextInt();
while (fourthChoice > 3 || fourthChoice < 1){
System.out.println("Please enter a number
from what's mentioned above");
fourthChoice = input.nextInt();
}
switch(fourthChoice){
case 1 -> {
System.out.println("Enter the apropriate
replacements");
tour.editName(id, input.next());
tour.editId(id , input.nextInt());
tour.edit(id, input.nextInt());
}
case 2 -> {
System.out.println("Enter the apropriate
replacements Category from 1 to 4 respectively ");
tour.editDate(id, input.nextInt());
tour.editCategory(id , input.nextInt());
tour.editTourGuide(input.nextInt(),input.nextInt(),id);
}
case 3 -> {
tour.editSites(id, input.next());
tour.editPrice(id, input.nextInt());
tour.editProfit(id, input.nextInt());
}
}
System.out.println("If you want to edit
another thing press 0 if not press 1");
countTourEdit = input.nextInt();
}
}
case 3 -> {
int countTourDelete = 0;
while(countTourDelete == 0){
System.out.println("Enter Tour Id");
int id = input.nextInt();
tour = tour.findTourById(id);
tour.cancelTour(id);
System.out.println("If you want to delete
another thing press 0 if not press 1");
countTourDelete = input.nextInt();
}
}
}
System.out.println("If manage tours again press 0 if
not press 1");
countTour = input.nextInt();
}
}
case 2 -> {
int countTourGuide = 0;
while (countTourGuide == 0){
System.out.println("What do you want to do with
Tour Guides:");
System.out.println("Press 1 to add Tour Guide
\nPress 2 to edit Tour Guide \nPress 3 to delete Tour Guide
\nPress 4 to view Tour Guides \nPress 5 to Assign Tour Guide \n");
int fifthChoice = input.nextInt();
while (fifthChoice > 5 || fifthChoice < 1){
System.out.println("Please enter a number from
what's mentioned above");
fifthChoice = input.nextInt();
}
switch(fifthChoice){
case 1 -> {
int countAddTourGuide = 0;
while (countAddTourGuide == 0){
tourguide.addTourGuide(tourguide);
System.out.println("Please enter the Tour
Guide's information");
System.out.println("Id");
tourguide.setTg_Id(input.nextInt());
System.out.println("Name");
tourguide.setTg_Name(input.next());
System.out.println("Age");
tourguide.setTg_Age(input.nextInt());
System.out.println("Salary");
tourguide.setTg_Salary(input.nextInt());
System.out.println("If you want to add
another thing press 0 if not press 1");
countAddTourGuide = input.nextInt();
}
}
case 2 -> {
int countEditTourGuide = 0;
while (countEditTourGuide == 0){
System.out.println("Enter Tour Guide Id");
int id = input.nextInt();
tourguide = tourguide.findTourGuideById(id);
System.out.println("What do you want to edit
:");
System.out.println("Press 1 to edit name, Id ,
Age and Salary \nPress 2 to edit Assigned Tours\n");
int sixthChoice = input.nextInt();
while (sixthChoice > 2 || sixthChoice < 1){
System.out.println("Please enter a number
from what's mentioned above");
sixthChoice = input.nextInt();
}
switch(sixthChoice){
case 1 -> {
System.out.println("Enter the apropriate
replacements");
tourguide.editName(id, input.next());
tourguide.editId(id , input.nextInt());
tourguide.edit(id, input.nextInt());
tourguide.editSalary(id, input.nextInt());
}
case 2 -> {
System.out.println("Enter New Tour Id
and Old Tour Id respectively");
tourguide.editAssignedTours(input.nextInt(),input.nextInt(),id);
}
}
System.out.println("If you want to edit
another thing press 0 if not press 1");
countEditTourGuide = input.nextInt();
}
}
case 3 -> {
int countTourGuideDelete = 0;
while(countTourGuideDelete == 0){
System.out.println("Enter Tour Guide Id");
int id = input.nextInt();
tourguide = tourguide.findTourGuideById(id);
tourguide.deleteTourGuide(id);
System.out.println("If you want to delete
another thing press 0 if not press 1");
countTourGuideDelete = input.nextInt();
}
}
case 4 -> {
tourguide.viewTourGuideInformation(tourguide.getTourGuides());
}
case 5 -> {
int CountAssignTourGuide = 0;
while(CountAssignTourGuide == 0){
System.out.println("Enter Tour Guide Id");
int id = input.nextInt();
tourguide = tourguide.findTourGuideById(id);
System.out.println("Enter Tour Id");
int tourId = input.nextInt();
tourguide.assignTourGuideToTour(id, tourId);
System.out.println("If you want to assign tour
guide to tour again press 0 if not press 1");
CountAssignTourGuide = input.nextInt();
}
}
}
System.out.println("If you want to manage tour
guides again press 0 if not press 1");
countTourGuide = input.nextInt();
}
}
case 3 -> {
int countClient = 0;
while (countClient == 0){
System.out.println("What do you want to do with
Clients:");
System.out.println("Press 1 to add Client \nPress 2 to
edit Client \nPress 3 to delete Client \nPress 4 to view Clients
\nPress 5 to Cancel Client Tours \n");
int seventhChoice = input.nextInt();
while (seventhChoice > 6 || seventhChoice < 1){
System.out.println("Please enter a number from
what's mentioned above");
seventhChoice = input.nextInt();
}
switch(seventhChoice){
case 1 -> {
int countAddClient = 0;
while (countAddClient == 0){
client.addClient(client);
System.out.println("Please enter the Client's
information");
System.out.println("Id");
client.setC_Id(input.nextInt());
System.out.println("Name");
client.setC_Name(input.next());
System.out.println("Age");
client.setC_age(input.nextInt());
System.out.println("Current Tour Id");
int addCurrentTourId = input.nextInt();
tour = tour.findTourById(addCurrentTourId);
client.setC_currentTour(tour);
System.out.println("If you want to add
another thing press 0 if not press 1");
countAddClient = input.nextInt();
}
}
case 2 -> {
int countEditClient = 0;
while (countEditClient == 0){
System.out.println("Enter Client Id");
int id = input.nextInt();
client = client.findClientById(id);
System.out.println("What do you want to edit
:");
System.out.println("Press 1 to edit name and
Id\nPress 2 to edit Age\n");
int eigthChoice = input.nextInt();
while (eigthChoice > 2 || eigthChoice < 1){
System.out.println("Please enter a number
from what's mentioned above");
eigthChoice = input.nextInt();
}
switch(eigthChoice){
case 1 -> {
System.out.println("Enter Name then
Id");
client.editName(id, input.next());
client.editId(id , input.nextInt());
}
case 2 -> {
System.out.println("Enter Age");
client.edit(id, input.nextInt());
}
}
System.out.println("If you want to edit
another thing press 0 if not press 1");
countEditClient = input.nextInt();
}
}
case 3 -> {
int countClientDelete = 0;
while(countClientDelete == 0){
System.out.println("Enter Client Id");
int id = input.nextInt();
client = client.findClientById(id);
client.deleteClient(id);
System.out.println("If you want to delete
another thing press 0 if not press 1");
countClientDelete = input.nextInt();
}
}
case 4 -> {
client.viewClientInformation(client.getClients());
}
case 5 -> {
int countClientCancel = 0;
while(countClientCancel == 0){
System.out.println("Enter Client Id");
int id = input.nextInt();
System.out.println("Enter Tour Id");
int tourId = input.nextInt();
client.cancelClientTour(id, tourId);
System.out.println("If you want to cancel
another thing press 0 if not press 1");
countClientCancel = input.nextInt();
}
}
case 6 -> {
int countClientPostpone = 0;
while(countClientPostpone == 0){
System.out.println("Enter Client Id");
int id = input.nextInt();
client.checkToPostpone(id);
System.out.println("If you want to postpone
another clients tour press 0 if not press 1");
countClientPostpone = input.nextInt();
}
}
}
System.out.println("If manage clients again press 0 if
not press 1");
countClient = input.nextInt();
}
}
}
System.out.println("If you want to do another process press
0 if not press 1");
countMain = input.nextInt();
if (countMain == 1)
System.out.println("Thank you for using our app");
}
}