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
6 changes: 1 addition & 5 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_241">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
2 changes: 1 addition & 1 deletion build/classes/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/controller/
/model/
/controller/
/services/
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.
7 changes: 5 additions & 2 deletions src/controller/BusController.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.Bus;
import services.FareCalculator;

@WebServlet(urlPatterns= {"/bus"})
public class BusController extends HttpServlet {
private static final long serialVersionUID = 1L;
Expand All @@ -28,7 +31,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"));
String bustype=request.getParameter("bustype");
Expand Down Expand Up @@ -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);
*/ }
}

}
7 changes: 5 additions & 2 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 Down Expand Up @@ -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);
*/}
}

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

import model.Hotel;


/*import model.Hotel;
import services.FareCalculator;*/

import model.Hotel;
import services.FareCalculator;



Expand All @@ -33,7 +35,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 +69,6 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/hotelOutputView.jsp");
dispatcher.forward(request, response);

*/ }
}

}
7 changes: 5 additions & 2 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 Down Expand Up @@ -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);
*/}
}

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

import java.time.LocalDate;

// Type your code
public class Bus{

//instance variables/arguments
private int noOfPersons;
private String busType;
private int rates;
private LocalDate date;


//getter and 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, int rates, String busType, LocalDate date) {
super();
this.noOfPersons = noOfPersons;
this.busType = busType;
this.rates = rates;
this.date = date;
}

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

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

//Type your code
public class Flight{

//instance variables/arguments
private int noOfPersons;
private String classType;
private int rates;
private LocalDate from;
private LocalDate to;
private String triptype;

//getter and setter
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;
}

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

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

//class hotel
public class Hotel{
private int noOfPersons;
private String roomType;
private int rates;
private String occupancy;
private LocalDate fromdate;
private LocalDate todate;

//getter and setter
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;
}

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

}
49 changes: 48 additions & 1 deletion src/model/Train.java
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
package model;
// Type your code
import java.time.LocalDate;

//Type your code

//class train
public class Train{
private int noOfPersons;
private String berth;
private int rates;
private LocalDate date;


//getter and setter
public int getNoOfPersons() {
return noOfPersons;
}
public void setNoOfPersons(int noOfPersons) {
this.noOfPersons = noOfPersons;
}
public String getBerth() {
return berth;
}
public void setBerth(String berth) {
this.berth = berth;
}
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 Train(int noOfPersons, int rates, String berth, LocalDate date) {
super();
this.noOfPersons = noOfPersons;
this.berth = berth;
this.rates = rates;
this.date = date;
}

}
14 changes: 14 additions & 0 deletions src/services/Booking.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@

// Type your code

//parent class
public class Booking{

//method returning rates
public double booking(int noOfPersons,int rates)
{

double d=(double)noOfPersons*rates;
return d;

}


}
Loading