-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from devil419/main
Add files via upload
- Loading branch information
Showing
11 changed files
with
803 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
package ticketer; | ||
|
||
public class Bus extends Vehicle | ||
{ | ||
private String seatNo, ac; | ||
|
||
public Bus(){}//// Empty Constructor | ||
/// Parametrized Constructor Below | ||
public Bus(String vehicleName,String vehicleType,String member,String vehicleNo,String seatNo,String ac) | ||
{ | ||
super(vehicleName,vehicleType,member,vehicleNo); | ||
this.seatNo =seatNo; | ||
this.ac =ac; // (Y/N) | ||
} | ||
|
||
/// Setter Methods | ||
|
||
public void setSeatNo(String seatNo) | ||
{ | ||
this.seatNo =seatNo; | ||
} | ||
|
||
public void setAc(String seatNo) | ||
{ | ||
this.ac =ac; | ||
} | ||
|
||
///// Getter Methods | ||
|
||
public String getSeatNo() | ||
{ | ||
return seatNo; | ||
} | ||
|
||
public String getAc() | ||
{ | ||
return ac; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
|
||
package ticketer; | ||
|
||
import java.util.Scanner; | ||
|
||
public class ChooseRoot extends TravelLocation | ||
{ | ||
Scanner input = new Scanner(System.in); | ||
String vehicleName,vehicleType,member,vehicleNo,seatNo,food,ac; | ||
double foodCost,acCost; | ||
|
||
ChooseRoot(){} | ||
ChooseRoot(int root) | ||
{ | ||
|
||
|
||
switch(root) | ||
{ | ||
case 1: | ||
{ | ||
// Bus | ||
System.out.print("Enter Vehicle Type : Bus"); | ||
vehicleType = "Bus"; | ||
|
||
System.out.print("Enter Respective Company Name : "); | ||
vehicleName = input.nextLine(); | ||
|
||
System.out.print("Enter member amount : "); | ||
member = input.nextLine(); | ||
|
||
System.out.print("Enter Vehicle Number : "); | ||
vehicleNo = input.nextLine(); | ||
|
||
System.out.print("Enter Seat Number : "); | ||
seatNo = input.nextLine(); | ||
|
||
System.out.print("AC/Non-AC (Y/N) : "); | ||
ac = input.nextLine(); | ||
ac = ac.toLowerCase(); | ||
|
||
if(ac.equals('y')) | ||
{ | ||
///// implement of an increase in money 800/- | ||
acCost = 800; | ||
} | ||
|
||
Bus b1 = new Bus(vehicleName,vehicleType,member,vehicleNo,seatNo,ac); | ||
break; | ||
} | ||
|
||
case 2: | ||
{ | ||
// Train | ||
|
||
System.out.print("Enter Vehicle Type : Train"); | ||
vehicleType = "Train"; | ||
|
||
System.out.print("Enter Respective Company Name : "); | ||
vehicleName = input.nextLine(); | ||
|
||
System.out.print("Enter member amount : "); | ||
member = input.nextLine(); | ||
|
||
System.out.print("Enter Vehicle Number : "); | ||
vehicleNo = input.nextLine(); | ||
|
||
System.out.print("Enter Seat Number : "); | ||
seatNo = input.nextLine(); | ||
|
||
System.out.print("Food/Without-Food (Y/N) : "); | ||
food = input.nextLine(); | ||
food = food.toLowerCase(); | ||
|
||
if(food.equals('y')) | ||
{ | ||
///// implement of an increase in money 500/- | ||
foodCost = 500; | ||
} | ||
|
||
System.out.print("AC/Non-AC (Y/N) : "); | ||
ac = input.nextLine(); | ||
ac = ac.toLowerCase(); | ||
|
||
if(ac.equals('y')) | ||
{ | ||
///// implement of an increase in money 800/- | ||
acCost = 800; | ||
} | ||
|
||
Train t1 = new Train(vehicleName,vehicleType,member,vehicleNo,seatNo,food,ac); | ||
break; | ||
|
||
} | ||
case 3: | ||
{ | ||
//plane | ||
|
||
System.out.print("Enter Vehicle Type : Plane"); | ||
vehicleType = "Plane"; | ||
|
||
System.out.print("Enter Respective Company Name : "); | ||
vehicleName = input.nextLine(); | ||
|
||
System.out.print("Enter member amount : "); | ||
member = input.nextLine(); | ||
|
||
System.out.print("Enter Vehicle Number : "); | ||
vehicleNo = input.nextLine(); | ||
|
||
System.out.print("Enter Seat Number : "); | ||
seatNo = input.nextLine(); | ||
|
||
System.out.print("Food/Without-Food (Y/N) : "); | ||
food = input.nextLine(); | ||
food = food.toLowerCase(); | ||
|
||
if(food.equals('y')) | ||
{ | ||
///// implement of an increase in money 500/- | ||
foodCost = 500; | ||
} | ||
|
||
Plane p1 = new Plane(vehicleName,vehicleType,member,vehicleNo,seatNo,food); | ||
break; | ||
|
||
} | ||
case 4: | ||
{ | ||
// Ship | ||
|
||
|
||
System.out.print("Enter Vehicle Type : Ship"); | ||
vehicleType = "Ship"; | ||
|
||
System.out.print("Enter Respective Company Name : "); | ||
vehicleName = input.nextLine(); | ||
|
||
System.out.print("Enter member amount : "); | ||
member = input.nextLine(); | ||
|
||
System.out.print("Enter Vehicle Number : "); | ||
vehicleNo = input.nextLine(); | ||
|
||
System.out.print("Enter Seat Number : "); | ||
seatNo = input.nextLine(); | ||
|
||
System.out.print("Food/Without-Food (Y/N) : "); | ||
food = input.nextLine(); | ||
food = food.toLowerCase(); | ||
|
||
if(food.equals('y')) | ||
{ | ||
///// implement of an increase in money 500/- | ||
foodCost = 500; | ||
} | ||
|
||
System.out.print("AC/Non-AC (Y/N) : "); | ||
ac = input.nextLine(); | ||
ac = ac.toLowerCase(); | ||
|
||
if(ac.equals('y')) | ||
{ | ||
///// implement of an increase in money 800/- | ||
acCost = 800; | ||
} | ||
|
||
Ship s1 = new Ship(vehicleName,vehicleType,member,vehicleNo,seatNo,food,ac); | ||
break; | ||
|
||
|
||
|
||
|
||
} | ||
default:{System.out.println("Choose A Valid Option (1-4)");} | ||
|
||
|
||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
package ticketer; | ||
|
||
public class CostCalculation extends Reservation | ||
{ | ||
double totalCost; | ||
CostCalculation(){} | ||
|
||
Reservation r = new Reservation(); | ||
|
||
public double totalCost() | ||
{ | ||
/// Variations With Root Type | ||
if(r.vehicleType.equals("Bus")) | ||
{ | ||
return totalCost = ((r.travelCost()+r.foodCost+r.acCost)+r.returnCost); | ||
} | ||
|
||
else if(r.vehicleType.equals("Train")) | ||
{ | ||
return totalCost = ((r.travelCost()+r.foodCost+r.acCost)+r.returnCost)*0.7; | ||
} | ||
|
||
else if(r.vehicleType.equals("Plane")) | ||
{ | ||
return totalCost = ((r.travelCost()+r.foodCost+r.acCost)+r.returnCost)*5; | ||
} | ||
else | ||
{ | ||
return totalCost = ((r.travelCost()+r.foodCost+r.acCost)+r.returnCost)*0.5; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
package ticketer; | ||
|
||
import java.util.Scanner; | ||
|
||
public class Payment | ||
{ | ||
String accountNumber; | ||
|
||
Payment(int choice) | ||
{ | ||
Scanner input = new Scanner(System.in); | ||
|
||
switch(choice) | ||
{ | ||
case 1: | ||
{ | ||
/// BKash | ||
System.out.print("Enter BKash Number : "); | ||
accountNumber = input.nextLine(); | ||
|
||
System.out.println("-----------------------------------"); | ||
System.out.println("| PAYMENT SUCCESSFUL !!! | "); | ||
System.out.println("-----------------------------------"); | ||
|
||
} | ||
|
||
case 2: | ||
{ | ||
/// Rocket | ||
System.out.print("Enter Rocket Number : "); | ||
accountNumber = input.nextLine(); | ||
|
||
System.out.println("-----------------------------------"); | ||
System.out.println("| PAYMENT SUCCESSFUL !!! | "); | ||
System.out.println("-----------------------------------"); | ||
|
||
} | ||
|
||
case 3: | ||
{ | ||
/// Credit Card | ||
System.out.print("Enter Credit Card Number : "); | ||
accountNumber = input.nextLine(); | ||
|
||
System.out.println("-----------------------------------"); | ||
System.out.println("| PAYMENT SUCCESSFUL !!! | "); | ||
System.out.println("-----------------------------------"); | ||
|
||
} | ||
default:{System.out.println("Choose A Valid Option (1-3)");} | ||
|
||
|
||
} | ||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
package ticketer; | ||
|
||
public class Plane extends Vehicle | ||
{ | ||
private String seatNo,food; | ||
|
||
public Plane(){}//// Empty Constructor | ||
/// Parametrized Constructor Below | ||
public Plane(String vehicleName,String vehicleType,String member,String vehicleNo,String seatNo,String food) | ||
{ | ||
super(vehicleName,vehicleType,member,vehicleNo); | ||
this.seatNo =seatNo; | ||
this.food =food; // (Y/N) | ||
|
||
} | ||
|
||
/// Setter Methods | ||
|
||
public void setSeatNo(String seatNo) | ||
{ | ||
this.seatNo =seatNo; | ||
} | ||
|
||
public void setFood(String food) | ||
{ | ||
this.food =food; | ||
} | ||
|
||
///// Getter Methods | ||
|
||
public String getSeatNo() | ||
{ | ||
return seatNo; | ||
} | ||
|
||
public String getFood() | ||
{ | ||
return food; | ||
} | ||
|
||
|
||
|
||
|
||
} |
Oops, something went wrong.