Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FY_25_Tourism #26

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions Team25-TourismBooingSystem/Bill.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package tourismbooking;

import java.util.*;

// Assuming Booking is defined in the same package
public class Bill {
private double total; // To store the total bill amount

// Constructor to create a bill from a booking

public Bill(Booking booking) {

// Simple calculation based on the number of persons
this.total = booking.getNoOfPersons() * booking.selectedPackage.price;
// Calculate the total bill
}
public void bday_anvys()
{ Scanner sc= new Scanner(System.in);
System.out.println("Does anybody in your group have birthday or anniversary during tour? (only one date can be used) , enter y for yes");
char ch=sc.nextLine().charAt(0);


if (ch=='y')
{ System.out.println("CONGRATULATIONS!!! you get an additional 5% discount on your bill !");
System.out.println("Enter birth date of said person, format = DD/MM/YYYY(It will be verified on spot during check in, a fine will be implied if false information provided)");
String bdate= sc.nextLine();
total = total - (0.05*total);
System.out.println("You saved : Rs."+0.05*total);
}
else
System.out.println("Sorry. No discount.");


System.out.println("Your bill (excluding taxes) comes out to be:" + total);

}
public void srctz()
{ Scanner sc= new Scanner(System.in);
System.out.println("Is any senior citizen , age greater than or equal to 75 in your group?, enter y for yes : ");
char ch=sc.nextLine().charAt(0);


if (ch=='y')
{ System.out.println("CONGRATULATIONS!!! you get an additional 5% discount on your bill !");
System.out.println("Enter age of said person(It will be verified on spot during check in, a fine will be implied if false information provided)");
String bdate= sc.nextLine();
total= total - (0.05*total);
System.out.println("You saved Rs: "+0.05*total);
}
else
System.out.println("Sorry. No discount.");

System.out.println("Your bill (excluding taxes) comes out to be:" +total);

}
public void couple(Booking booking)
{ Scanner sc= new Scanner(System.in);
if (booking.getNoOfPersons()==2)
{ System.out.println("CONGRATULATIONS!!! you get an additional 10% discount on your bill !");
total= total - (0.10*total);
System.out.println("You saved : Rs."+0.10*total);
}
else
System.out.println("Sorry. No discount.");
System.out.println("Your bill (excluding taxes) comes out to be:" +total);

}
public void group(Booking booking)
{
if (booking.getNoOfPersons()>5)
{ System.out.println("CONGRATULATIONS!!! you get an additional 7% discount per person on your bill !");

total= total - (0.07*total);
System.out.println("You saved : Rs."+0.07*total);

}
else
System.out.println("Sorry. No discount.");


System.out.println("Your bill (excluding taxes) comes out to be:" +total);



}
public double getTotal() {
System.out.println("GST (18%) : "+0.18*total);
return total + 0.18*total; // Return the total bill
}

@Override
public String toString() {
return "Total Bill: " + total;
}
}
50 changes: 50 additions & 0 deletions Team25-TourismBooingSystem/Booking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package tourismbooking;

public class Booking {
private int noOfPersons;
private long mob;
private String email;
private Person persons[];
private int index=0;
Packages.Package selectedPackage;

public Booking(int noOfPersons, long mob, String email) {
this.noOfPersons = noOfPersons;
this.mob = mob;
this.email = email;
this.persons = new Person[noOfPersons];
}
public void addPerson(Person person) {
if (index < noOfPersons) {
persons[index] = person;
index++;
}


}

public void addPackage(Packages.Package packageToAdd) {

this.selectedPackage = packageToAdd;
System.out.println("----------------------------------------");
System.out.println("Package added successfully : ");
System.out.println(packageToAdd);
System.out.println("----------------------------------------");
}

public int getNoOfPersons() {
return noOfPersons;
}

public long getMob() {
return mob;
}

public String getEmail() {
return email;
}

public Person[] getPersons() {
return persons;
}
}
232 changes: 232 additions & 0 deletions Team25-TourismBooingSystem/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
package tourismbooking;

import java.util.Scanner;
import java.util.ArrayList;
public class Main {
public static void clearScreen()
{
for (int i = 0; i < 10; i++) { // Adjust the number for your preference
System.out.println(); // Print blank lines
}
}
public static void main(String[] args) {
long mobile;
int noOfPersons;
char gender;
Scanner scanner = new Scanner(System.in);
System.out.println("****************************************");
System.out.println("\tENTER USER INFORMATION : ");
System.out.println("****************************************");

do {
System.out.println("Enter the number of persons : ");
noOfPersons = scanner.nextInt();
scanner.nextLine();
if(noOfPersons<=0)
System.out.println("Invalid number of persons. Please try again:");
}while(noOfPersons<=0);

do {
System.out.println("Enter your mobile number : ");
mobile = scanner.nextLong();
scanner.nextLine();
if(String.valueOf(mobile).length() != 10)
System.out.println("Invalid Mobile number. Please enter again : ");
}while(String.valueOf(mobile).length() != 10);

System.out.println("Enter your email address:");
String email = scanner.nextLine();


Booking booking = new Booking(noOfPersons, mobile, email);


for (int i = 0; i < noOfPersons; i++) {
System.out.println("-------------------------------------------");
System.out.println("Enter details for person " + (i + 1) + ":");

System.out.print("First Name: ");
String firstName = scanner.nextLine();

System.out.print("Last Name: ");
String lastName = scanner.nextLine();

System.out.print("Age: ");
int age = scanner.nextInt();
scanner.nextLine();


System.out.println("Aadhaar Number: ");
String aadhaar = scanner.nextLine();

System.out.print("Gender (m/f) :");
do {
gender = scanner.nextLine().charAt(0);
if(gender!='m' && gender!='f')
System.out.println("Invalid selection. Please try again : ");
}while(gender!='m' && gender!='f');



Person person = new Person(firstName, lastName, age, aadhaar, gender);
booking.addPerson(person);
}
System.out.println("Press ENTER to continue....");
scanner.nextLine();
clearScreen();
// Step 1: Add hill stations
Places.addHillStations(); // Initialize the list of hill stations

// Step 2: Display hill stations with their attractions
ArrayList<Places.Place> hillStations = Places.getHillStations();

System.out.println("****************************************");
System.out.println("Available Hill Stations with Attractions:");
System.out.println("****************************************");

for (int i = 0; i < hillStations.size(); i++) {
Places.Place place = hillStations.get(i);

System.out.println((i + 1) + ". " + place.getDestination()); // Display destination name

System.out.println("Attractions:");
for (String attraction : place.getAttractions()) {
if (attraction != null) { // Check for null values
System.out.println("- " + attraction); // Display each attraction
}
}

System.out.println(); // Add a blank line for readability
}

// Step 3: User selects a hill station
System.out.println("Select a hill station by entering its number:");
int choice = scanner.nextInt();
scanner.nextLine(); // Consume newline character

if (choice < 1 || choice > hillStations.size()) { // Validate the choice
System.out.println("Invalid selection. Please choose a valid number.");
} else {
// Step 4: Display selected hill station with its attractions
Places.Place selectedPlace = hillStations.get(choice - 1); // Adjust for 1-based index
System.out.println("----------------------------------------");
System.out.println("\nYou selected : " + selectedPlace.getDestination());

System.out.println("Attractions at " + selectedPlace.getDestination() + ":");
for (String attraction : selectedPlace.getAttractions()) {
if (attraction != null) {
System.out.println("- " + attraction); // Display attraction
}

}
System.out.println("----------------------------------------");
}
System.out.println("Press ENTER to continue....");
scanner.nextLine();
clearScreen();

Packages.addPackages();
Packages.displayPackages();


System.out.println("\nSelect the package number you want to book:");
int packageChoice = scanner.nextInt();
scanner.nextLine();

if (packageChoice < 1 || packageChoice > 6) {
System.out.println("Invalid package selection.");
} else {
Packages.Package selectedPackage = Packages.allPackages[packageChoice - 1];
booking.addPackage(selectedPackage);
}

// Create a bill based on the booking
Bill bill = new Bill(booking);

System.out.println("Press ENTER to continue....");
scanner.nextLine();
clearScreen();

System.out.println("****************************************");
System.out.println("\tDISCOUNTS");
System.out.println("****************************************");
System.out.println("\nDiscounts available :\n 1. couples discount -> 10% \n 2.group discount -> 7% for groups with 5+ members \n 3.brithday/anniversary discount -> 5% \n 4.senior citizen discount -> 5% ");
System.out.println("\nEnter option number if applicable(0 if not applicable) : ");
int ch=scanner.nextInt();
switch(ch)
{ case(1):
bill.couple(booking);
break;

case (2):
bill.group(booking);
break;
case (3):
bill.bday_anvys();
break;
case (4):
bill.srctz();
break;
default:
System.out.println("Oops, No discount. ");
}

System.out.println("----------------------------------------");
System.out.println("\nTotal Bill Amount: Rs."+bill.getTotal());
System.out.println("----------------------------------------");

System.out.println("Press ENTER to continue....");
scanner.nextLine();
clearScreen();

System.out.println("\n******************************************");
System.out.println("Choose method of payment: (0 = card / 1 = UPI)");
System.out.println("*********************************************");
int paymentMethod = scanner.nextInt();

if (paymentMethod == 1) {
System.out.println("Enter UPI ID:");
String upi = scanner.next();

System.out.println("Enter the 4-digit passcode:");
int passcode = scanner.nextInt();

System.out.println("Are you sure you want to proceed? (0 = yes / 1 = no)");
int proceed = scanner.nextInt();

if (proceed == 0) {
System.out.println("-------------------------------------");
System.out.println("\tPAYMENT SUCCESSFUL");
System.out.println("-------------------------------------");
System.out.println("A confirmation with booking details will be emailed to you.");
System.out.println("**Thank You**");
} else {
System.out.println("Payment Cancelled");
}
} else if (paymentMethod == 0) {
System.out.println("Enter card number:");
long cardNumber = scanner.nextLong();

System.out.println("Enter 4-digit OTP:");
int otp = scanner.nextInt();

System.out.println("Are you sure you want to proceed? (0 = yes / 1 = no)");
int proceed = scanner.nextInt();

if (proceed == 0) {
System.out.println("-------------------------------------");
System.out.println("\tPAYMENT SUCCESSFUL");
System.out.println("-------------------------------------");
System.out.println("A confirmation with booking details will be emailed to you.");
System.out.println("**Thank You**");
} else {
System.out.println("Payment Cancelled");
}
} else {
System.out.println("Invalid payment method.");
}

scanner.close();
}
}

Loading