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>
3 changes: 0 additions & 3 deletions build/classes/.gitignore

This file was deleted.

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.
Binary file added build/classes/model/Bus.class
Binary file not shown.
Binary file added build/classes/model/Flight.class
Binary file not shown.
Binary file added build/classes/model/Hotel.class
Binary file not shown.
Binary file added build/classes/model/Train.class
Binary file not shown.
Binary file added build/classes/services/Booking.class
Binary file not shown.
Binary file added build/classes/services/FareCalculator.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);
*/}
}

}
8 changes: 4 additions & 4 deletions src/controller/HotelController.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@



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



Expand All @@ -33,7 +33,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 +67,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);
*/}
}

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

import java.time.LocalDate;

// Type your code
//parent class called Bus
public class Bus{
private int noOfPersons;
private int rates;
private String busType;
private LocalDate date;
public int getNoOfPersons() {
return noOfPersons;
}
public void setNoOfPersons(int noOfPersons) {
this.noOfPersons = noOfPersons;
}
public int getRates() {
return rates;
}
public void setRates(int rates) {
this.rates = rates;
}
public String getBusType() {
return busType;
}
public void setBusType(String busType) {
this.busType = busType;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Bus(int noOfPersons, int rates, String busType, LocalDate date) {
super();
this.noOfPersons = noOfPersons;
this.rates = rates;
this.busType = busType;
this.date = date;
}


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

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

//Type your code
//parent class called Flight
public class Flight{
private int noOfPersons;
private int rates;
private String classType;
private LocalDate from;
private LocalDate to;
private String triptype;
//appropriate getters and setters
public int getNoOfPersons() {
return noOfPersons;
}
public void setNoOfPersons(int noOfPersons) {
this.noOfPersons = noOfPersons;
}
public int getRates() {
return rates;
}
public void setRates(int rates) {
this.rates = rates;
}
public String getClassType() {
return classType;
}
public void setClassType(String classType) {
this.classType = classType;
}
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.rates = rates;
this.classType = classType;
this.from = from;
this.to = to;
this.triptype = triptype;
}


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

import java.time.LocalDate;

// Type your code

public class Hotel{
//parent class called Hotel
private int noOfPersons;
private String roomType;
private int rates;
private String occupancy;
private LocalDate fromdate;
private LocalDate todate;
//appropriate getters and setters
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) {
super();
this.noOfPersons = noOfPersons;
this.roomType = roomType;
this.rates = rates;
this.occupancy = occupancy;
this.fromdate = fromdate;
this.todate = todate;
}

//constructor



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

import java.time.LocalDate;

//parent class called Train
public class Train{
private int noOfPersons;
private int rates;
private String berth;
private LocalDate date;
//appropriate getters and setters
public int getNoOfPersons() {
return noOfPersons;
}
public void setNoOfPersons(int noOfPersons) {
this.noOfPersons = noOfPersons;
}
public int getRates() {
return rates;
}
public void setRates(int rates) {
this.rates = rates;
}
public String getBerth() {
return berth;
}
public void setBerth(String berth) {
this.berth = berth;
}
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.rates = rates;
this.berth = berth;
this.date = date;
}

}
9 changes: 8 additions & 1 deletion src/services/Booking.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
package services;

// Type your code

//class called as Booking
public class Booking{
//method public double booking(int noOfPersons,int rates).
public double booking(int noOfPersons,int rates) {
double totalRate =noOfPersons*rates;
return totalRate;
}
}
Loading