Skip to content
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
1 change: 1 addition & 0 deletions build/classes/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/controller/
/model/
/services/
/testing/
Binary file modified build/classes/controller/BusController.class
Binary file not shown.
Binary file modified build/classes/controller/FlightController.class
Binary file not shown.
Binary file modified build/classes/controller/HotelController.class
Binary file not shown.
Binary file modified build/classes/controller/TrainController.class
Binary file not shown.
11 changes: 7 additions & 4 deletions src/controller/BusController.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package controller;

import java.io.IOException;

import java.time.LocalDate;

import javax.servlet.RequestDispatcher;
Expand All @@ -10,6 +11,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.Bus;
import services.*;

@WebServlet(urlPatterns= {"/bus"})
public class BusController extends HttpServlet {
private static final long serialVersionUID = 1L;
Expand All @@ -28,9 +32,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t


protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/*

int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
String bustype=request.getParameter("bustype");
String date=request.getParameter("start");
System.out.println(numberOfPersons);
Expand Down Expand Up @@ -58,7 +61,7 @@ else if(bustype.equals("nonacsemisleeper")) {

LocalDate start=LocalDate.parse(date);

Bus bus=new Bus(numberOfPersons,rates,bustype,start);
Bus bus=new Bus(numberOfPersons,bustype,rates,start);
bus.setNoOfPersons(numberOfPersons);
bus.setRates(rates);
bus.setBusType(bustype);
Expand All @@ -72,6 +75,6 @@ else if(bustype.equals("nonacsemisleeper")) {
request.setAttribute("busfare", rate);
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/busView.jsp");
dispatcher.forward(request, response);
*/ }
}

}
9 changes: 6 additions & 3 deletions src/controller/FlightController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.Flight;
import services.FareCalculator;



@WebServlet("/flight")
Expand All @@ -29,7 +32,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/* int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
String classtype=request.getParameter("class");
String from=request.getParameter("from");
String to=request.getParameter("to");
Expand All @@ -45,7 +48,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
LocalDate start=LocalDate.parse(from);
LocalDate end=LocalDate.parse(to);

Flight flight=new Flight(numberOfPersons,rates,classtype,start,end,triptype);
Flight flight=new Flight(numberOfPersons,classtype,rates,start,end,triptype);
flight.setNoOfPersons(numberOfPersons);
flight.setRates(rates);
flight.setClassType(classtype);
Expand All @@ -59,6 +62,6 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
request.setAttribute("flightfare", rate);
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/flightView.jsp");
dispatcher.forward(request, response);
*/}
}

}
7 changes: 5 additions & 2 deletions src/controller/HotelController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.Hotel;
import services.FareCalculator;



/*import model.Hotel;
Expand All @@ -33,7 +36,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/* int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
String roomtype=request.getParameter("roomtype");
String occupancy=request.getParameter("occupancy");
String from=request.getParameter("from");
Expand Down Expand Up @@ -67,6 +70,6 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/hotelOutputView.jsp");
dispatcher.forward(request, response);

*/ }
}

}
9 changes: 6 additions & 3 deletions src/controller/TrainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.Train;
import services.FareCalculator;


/**
* Servlet implementation class TrainController
Expand All @@ -31,7 +34,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t


protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/* int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
int numberOfPersons=Integer.parseInt(request.getParameter("persons"));
String berth=request.getParameter("berth");
String date=request.getParameter("to");
System.out.println(numberOfPersons);
Expand All @@ -55,7 +58,7 @@ else if(berth.equals("nonac")) {
}
LocalDate start=LocalDate.parse(date);

Train train=new Train(numberOfPersons,rates,berth,start);
Train train=new Train(numberOfPersons,berth,rates,start);
train.setNoOfPersons(numberOfPersons);
train.setRates(rates);
train.setBerth(berth);;
Expand All @@ -68,6 +71,6 @@ else if(berth.equals("nonac")) {
request.setAttribute("trainfare", trainfare);
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/trainView.jsp");
dispatcher.forward(request, response);
*/}
}

}
45 changes: 45 additions & 0 deletions src/model/Bus.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
package model;

import java.time.LocalDate;

// Type your code

public class Bus{
private int noOfPersons;
private String busType;
private int rates;
private LocalDate date;


//Getter-Setter
public int getNoOfPersons() {
return noOfPersons;
}
public void setNoOfPersons(int noOfPersons) {
this.noOfPersons = noOfPersons;
}
public String getBusType() {
return busType;
}
public void setBusType(String busType) {
this.busType = busType;
}
public int getRates() {
return rates;
}
public void setRates(int rates) {
this.rates = rates;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}

//CONSTRUCTOR
public Bus(int noOfPersons, String busType, int rates, LocalDate date) {
this.noOfPersons = noOfPersons;
this.busType = busType;
this.rates = rates;
this.date = date;
}

}
97 changes: 96 additions & 1 deletion src/model/Flight.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,98 @@
package model;

//Type your code
import java.time.LocalDate;

//Type your code

public class Flight{
private int noOfPersons;
private String classType;
private int rates;
private LocalDate from;
private LocalDate to;
private String triptype;



public int getNoOfPersons() {
return noOfPersons;
}



public void setNoOfPersons(int noOfPersons) {
this.noOfPersons = noOfPersons;
}



public String getClassType() {
return classType;
}



public void setClassType(String classType) {
this.classType = classType;
}



public int getRates() {
return rates;
}



public void setRates(int rates) {
this.rates = rates;
}



public LocalDate getFrom() {
return from;
}



public void setFrom(LocalDate from) {
this.from = from;
}



public LocalDate getTo() {
return to;
}



public void setTo(LocalDate to) {
this.to = to;
}



public String getTriptype() {
return triptype;
}



public void setTriptype(String triptype) {
this.triptype = triptype;
}



public Flight(int noOfPersons, String classType, int rates, LocalDate from, LocalDate to, String triptype) {
this.noOfPersons = noOfPersons;
this.classType = classType;
this.rates = rates;
this.from = from;
this.to = to;
this.triptype = triptype;
}

}
59 changes: 58 additions & 1 deletion src/model/Hotel.java
Original file line number Diff line number Diff line change
@@ -1,2 +1,59 @@
package model;
// Type your code
// Type your code

import java.time.LocalDate;

public class Hotel{
private int noOfPersons;
private String roomType;
private int rates;
private String occupancy;
private LocalDate fromdate;
private LocalDate todate;
public int getNoOfPersons() {
return noOfPersons;
}
public void setNoOfPersons(int noOfPersons) {
this.noOfPersons = noOfPersons;
}
public String getRoomType() {
return roomType;
}
public void setRoomType(String roomType) {
this.roomType = roomType;
}
public int getRates() {
return rates;
}
public void setRates(int rates) {
this.rates = rates;
}
public String getOccupancy() {
return occupancy;
}
public void setOccupancy(String occupancy) {
this.occupancy = occupancy;
}
public LocalDate getFromdate() {
return fromdate;
}
public void setFromdate(LocalDate fromdate) {
this.fromdate = fromdate;
}
public LocalDate getTodate() {
return todate;
}
public void setTodate(LocalDate todate) {
this.todate = todate;
}

public Hotel(int noOfPersons, String roomType, int rates, String occupancy, LocalDate fromdate, LocalDate todate) {
this.noOfPersons = noOfPersons;
this.roomType = roomType;
this.rates = rates;
this.occupancy = occupancy;
this.fromdate = fromdate;
this.todate = todate;
}

}
Loading