Car Rental System: Advanced Java Programming Lab
Car Rental System: Advanced Java Programming Lab
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
Submitted by
MR.SK.RAHOOF(19B91A05M6)
MR.SK.HAMEED(19B91A05M3)
BHIMAVARAM
CERTIFICATE
This is to certify that this is a bonafide work on “CAR RENTAL SYSTEM” and has been
submitted by Mr.SK.RAHOOF(19B91A05M6) and Mr.SK.HAMEED(19B91A05M3), In partial
fulfillment of the requirements for the award of the degree of Bachelor of Technology in Computer
Science and Engineering, during the academic year 2020-2021.The candidate worked right under my
supervision and guidance.
DESCRIPTION PAGE.NO.
S.No.
1
1 MODULES 1
3. DATABASE CONNECTIVITY 5
4. OUTPUT SCREENS 11
5. CODE 20
ABSTRACT
The Project titled "Car Rental System" is a car renting application for the purpose of renting the cars
for x number of days without any discomfort.
This project is designed to aid the car rental company to enable renting of cars through an online
system. It helps the users to search for available cars, view profiles and book the cars for the time. It
has a user-friendly interface which helps the user to check for cars and rent them for the period
specified. They could also make payment online. Based on the type of car required by the customer,
the user shall be able to make bookings. The use of internet technology has made it easy for the
customers to rent a car any time. This system makes the bookings easy. It saves time and labour. The
tool shall ask the user for information such as the date and time of journey, type of car etc. Also, it
will need an identification number. Using these details, the tool shall help the customer to book a car
for the journey.
1. MODULES
Authentication:
1. Username and Password are given.
2. If correct goes to login page or shows registration failure.
3. Verifies the credentials with the database and logins if true.
1.2 LOGIN MODULE:
Authentication:
1. Username and password from registration data.
2. If true goes into another page or shows login failure.
3. Verifies the credentials with the database and logins if true.
1. Username and carid from the registration data and car details.
2. Asks the user for the number of days he want to rent.
3. Ask the user for date and then the booking will be successful and goes to another page.
2.1 PURPOSE
In this project the user can easily rent the car which is available in our database. The user can pay the
money while they are returning the car.
2.2 SCOPE
The scope of this project is to solve the problem of complexity to the user.
2.3 OBJECTIVE
The main objective is to make the transaction easy, reduce the time and to maintain the data.
2.4 EXISTING SYSTEM
Existing Car Rental System Car Rental System service will help users to book a car for some fee
specified. Till now there was no clear web-based UI to help the users to rent the vehicle. They had to
manually rent the vehicle through their offices.
The proposed system of this project is that the user can pay the money specified for the car in the app
itself while returning the car. It saves a lot of time for the user.
Analysis focuses on producing a model of the system called the analysis model, which is correct,
complete, consistent, and verifiable. Analysis model is composed mainly of three individual models.
Functional model
Analysis object model
Analysis dynamic model
The functional model represents the use of case diagrams, the object model with class diagram and
the dynamic model with state chart and sequence diagrams.
Non-functional requirements are the limitations or constraints under which the system should
provide to users. Following are the non-functional requirements of the project
2.7.1 RELIABILITY
This system is more reliable and effective because of the quality of service to the user.
2.7.2 COST
This system is developed in the high-level languages front end using html and jsp back end
using MySQL. It will give a response to the end within the least time.
2.7.4 SUPPORTABILITY
2.7.5 SECURITY
This system provides high secured data. Only the admin can view, alter the user data. This
CNAME VARCHAR2(20)
USERID VARCHAR2(20)
MNO VARCHAR2(20)
LID VARCHAR2(30)
PASS VARCHAR2(20)
CARID VARCHAR2(20)
5.1 book.jsp
<html>
<style>
button{ position: fixed; top: 350px; left: 550px; } body{ background-image:
url('http://wallpapers.net/web/wallpapers/spot-light-background-hd-wallpaper/th
umbnail/lg.jpg');
background-repeat: no-repeat; background-attachment:
fixed; background-size: 100% 100%;
} button{ position:
absolute;
top: 315px; left: 752px; transform:
translate(-50%, -50%); -ms-transform:
translate(-50%, -50%); background-color:
#f1f1f1; color: black; font-size: 13px; font-
family: sans-serif; padding: 10px 16px;
border: none; cursor: pointer; border-radius:
5px;
} button:hover { background-
color: black; color: white;
}
h1{
font-size: 25px;
position: fixed; top:
100px; left: 535; font-
family: cursive;
} h2{
font-size: 25px;
position: fixed; top:
150px; left: 595; font-
family: cursive;
} h3{
font-size: 25px;
position: fixed; top:
200px; left: 705; font-
family: cursive;
}
</style>
<body>
<center>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
String id=request.getParameter("userid"); String
cid=request.getParameter("carid");
String nod=request.getParameter("noofdays");
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","ra
hoof","rahoof");
Connection con1=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","r
ahoof","rahoof");
Connection con2=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","r
ahoof","rahoof");
Statement st1=con.createStatement();
ResultSet rs1=st1.executeQuery("select carid from rent where carid='"+cid+"'"); if(rs1.next())
{
PreparedStatement st2=con.prepareStatement("delete from rent where carid=?");
st2.setString(1,cid); int rs2=st2.executeUpdate();
PreparedStatement pst=con1.prepareStatement("insert into
book(userid,carid,noofdays) values(?,?,?)"); pst.setString(1,id);
pst.setString(2,cid); pst.setString(3,nod); int r=pst.executeUpdate();
if(r!=0)
{
int nds=Integer.parseInt(nod);
Statement st3=con2.createStatement();
ResultSet rs3=st3.executeQuery("select amount,carname from car where
carid='"+cid+"'"); String bill = " "; String cve = " "; while(rs3.next())
{
bill = rs3.getString("amount"); cve =
rs3.getString("carname");
}
int amt=Integer.parseInt(bill); int pay
= nds*amt;
%>
<h1><%out.println("The Car You Booked Was: "+cve);%></h1>
<h3><% out.println("TOTAL AMOUNT "+pay);
%></h3>
<h2>You Can Pay After Returing The Car....!</h2>
<form action="test.html">
<button class="button">OK</div>
</form>
<%}
}
else
{%>
<jsp:forward page="sorry.html"></jsp:forward>
<%}
con.close();
%>
</center>
</body>
</html>
5.2 login.jsp
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
String id=request.getParameter("userid");
String p=request.getParameter("pass");
Class.forName("oracle.jdbc.driver.OracleDriver"); Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","ra
hoof","rahoof");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from register where userid='"+id+"' and
pass='"+p+"'");
if(rs.next())
{%>
<jsp:forward page="carcatalogue.html"></jsp:forward>
<%}
else {
out.println("Login Failure");
}
con.close();
%>
5.3 register.jsp
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
String n=request.getParameter("cname");
String id=request.getParameter("userid");
String no=request.getParameter("mno");
String ld=request.getParameter("lid");
String p=request.getParameter("pass");
Class.forName("oracle.jdbc.driver.OracleDriver"); Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","ra
hoof","rahoof");
PreparedStatement pst=con.prepareStatement("insert into register
(cname,userid,mno,lid,pass) values(?,?,?,?,?)");
pst.setString(1,n); pst.setString(2,id);
pst.setString(3,no); pst.setString(4,ld);
pst.setString(5,p); int r = pst.executeUpdate(); if(r==0)
out.println("failure"); else
{%>
<jsp:forward page="login.html"></jsp:forward>
<%}
con.close();
%>
5.4 return.jsp
<html>
<head> <style> body{ background-image: url('http://wallpapers.net/web/wallpapers/spot-
light-background-hd-wallpaper/th umbnail/lg.jpg');
background-repeat: no-repeat; background-attachment:
fixed; background-size: 100% 100%;
} h1{
font-size: 25px; position: fixed;
top: 200px; left: 615; font-
family: "serif",cursive;
} button{ position: fixed; top:
300px; left: 750; font-family:
"serif",cursive;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: #f1f1f1; color: black;
font-size: 15px; padding: 9px 18px; border:
none; cursor: pointer; border-radius: 5px;
}
.button:hover { background-color:
black; color: white;
}
</style> </head>
<body>
<center>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
String cid=request.getParameter("carid");
String nod=request.getParameter("noofdays");
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:XE","rahoof","rahoof"); Connection
con1=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","r
ahoof","rahoof"); Connection
con2=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","r
ahoof","rahoof");
PreparedStatement pst=con.prepareStatement("insert into rent (carid)
values(?)"); pst.setString(1,cid); int r=pst.executeUpdate(); if(r==0) {
out.println("Insertion Failure");
}
PreparedStatement pst1=con1.prepareStatement("update book set noofdays=? where
carid=?"); pst1.setString(1,nod); pst1.setString(2,cid); int r1=pst1.executeUpdate();
if(r1==0) { out.println("Updation Failure");
}
else
{
int nds=Integer.parseInt(nod);
Statement st2=con2.createStatement();
ResultSet rs1=st2.executeQuery("select amount from car where
carid='"+cid+"'"); String bill = " "; while(rs1.next())
{
bill = rs1.getString("amount");
}
int amt=Integer.parseInt(bill); int pay
= nds*amt;
%>
<h1><% out.println("TOTAL AMOUNT "+pay);
%></h1>
<form action="testpay.html">
<button ="submit" class="button">PAY</button>
</form>
<%}
con.close();
%>
</center>
</body>
</html>
5.5 index.html
<!DOCTYPE html>
<html>
<head> <style>
.container { position:
relative; width: 100%;
max-width: 400px;
}
body {
background-image: url('in.jpg'); background-
repeat: no-repeat; background-attachment: fixed;
background-size: 100% 100%; font-family:
"cursive",cursive,cursive;
.container .btn:hover {
background-color: black;
color: white; } h2
{
font-family: "cursive",cursive,cursive; text-
align:center; position: absolute; top: 10%;
left: 38%; text-shadow: 2px 2px 5px red;
} h3
{
font-family: "cursive",cursive,cursive; text-
align:center; position: absolute; top: 20%;
right: 30%; text-shadow: 2px 2px 5px red;
} h4
{
font-family: "cursive",cursive,cursive; text-
align:center; position: absolute; top: 30%;
right: 43%; text-shadow: 2px 2px 5px red;
}
</style> </head>
<body>
<h2 style="color:white;">Sorry......! For The Inconvience"</h2>
<h3 style="color:white;">The Car Is Not Available"kindly Go For Another
Car,Go To Back,</h3>
<h4 style="color:white;">CLICK ON The Back Button</h4>
<div class="container">
<form name="f1" action="carcatalogue.html" method="POST">
<button class="btn">Back</button>
</div>
</form>
</body>
</html>
5.6 testpay.html
body {
background-image: url('in.jpg'); background-
repeat: no-repeat; background-attachment: fixed;
background-size: 100% 100%; font-family:
"cursive",cursive,cursive;
} h3
{
font-family: "cursive",cursive,cursive; text-
align:center; position: absolute; top: 20%;
right: 30%; text-shadow: 2px 2px 5px red;
} h4
{
font-family: "cursive",cursive,cursive; text-
align:center; position: absolute; top: 30%;
right: 43%; text-shadow: 2px 2px 5px red;
}
</style> </head>
<body>
<h2 style="color:white;">Sorry......! For The Inconvience"</h2>
<h3 style="color:white;">The Car Is Not Available"kindly Go For Another
Car,Go To Back,</h3>
<h4 style="color:white;">CLICK ON The Back Button</h4>
<div class="container">
<form name="f1" action="carcatalogue.html" method="POST">
<button class="btn">Back</button>
</div>
</form>
</body>
</html>
5.7 test.html
<!DOCTYPE html>
<html>
<head> <style>
.container { position:
relative; width: 100%;
max-width: 400px;
}
body {
background-image: url('test1.jpg'); background-
repeat: no-repeat; background-attachment: fixed;
background-size: 100% 100%; font-family:
"cursive",cursive,cursive;
.container .btn:hover {
background-color: black;
color: white; } h2
{
font-family: "cursive",cursive,cursive; text-
align:center; position: absolute; top: 10%;
left: 38%; text-shadow: 2px 2px 5px red;
} h3
{
font-family: "cursive",cursive,cursive; text-
align:center; position: absolute; top: 20%;
right: 25%; text-shadow: 2px 2px 5px red;
} h4
{ fo
nt-
fam
ily:
"cur
sive
",cu
rsiv
e,cu
rsiv
e;
text
-
alig
n:ce
nter
;
posi
tion
:
abs
olut
e;
top:
30
%;
righ
t:
43
%;
text
-
sha
dow
:
2px
2px
5px
red;
}
</style> </head>
<body>
<h2 style="color:white;">YOUR PAYMENT IS SUCCESSFULL......!</h2>
<h3 style="color:white;">HOPE YOU ENJOYED YOUR JOURNEY,</h3>
<h4 style="color:white;">PLEASE.....!BOOK AGAIN </h4>
<div class="container">
<form name="f1" action="login.html" method="POST">
<button class="btn">Home</button>
</div>
</form>
5.8 carcatalogue.html
<!DOCTYPE html>
<html>
<head> <style>
* { box-sizing: border-box;
}
body {
margin: 0; font-family:
Arial;
}
.container .btn {
position: absolute; top: 150px; left: 150px;
transform: translate(-50%, -50%); -ms-
transform: translate(-50%, -50%);
background-color: #f1f1f1; color: black;
font-size: 16px; padding: 16px 30px;
border: none; cursor: pointer; border-radius:
5px; text-align: center;
}
.container .btn:hover {
background-color: black;
color: white; }
.column {
float: left;
width: 25%;
padding: 30px; }
.column img
{ opacity: 1.0;
cursor: pointer; }
.column img:hover
{ opacity: 2; }
.row:after {
content: "";
display: table;
clear: both; }
.container { position:
relative; display:
none; }
.topnav a:hover
{ background-color: #ddd;
color: black; }
h3 {
font
-
fam
ily:
"cur
sive
",cu
rsiv
e,cu
rsiv
e; }
#imgtext { position:
absolute; bottom:
15px; left: 15px;
color: white; font-
size: 20px;
}
</style> </head>
<body>
<div class="topnav">
<form name="f1" action="return.html" method="POST">
<a href="#returncars">RETURN CARS</a>
5.9 book.html
<!DOCTYPE html>
<html>
<head>
<title>RENT</title>
<style> div.relative
{
position: fixed;
left: 50px; top:
10px; } h1{
top: 30px; left:
50px;
} body
{
background-image: url('go1.jpg'); background-repeat:
no-repeat; background-attachment: fixed; background-
size: 100% 100%;
margin: 0;
padding: 0;
}
.box { width: 600px; height: 600px;
padding: 40px; position: absolute; top:
50%; left: 50%; transform: translate(-
50%,-50%); text-align: center; cursor:
pointer;
}
.box h1{ color: black; text-
transform: uppercase; font-
weight: 500; font-size: 20px;
}
.box input[type = "text"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 16px; border: 2px solid
#3498db; padding: 10px 10px;
width: 200px; outline: none;
color: black; border-radius:
24px; transition: 0.25s; cursor:
pointer;
}
.box input[type = "text"]{ width:
280px; border-color: #2ecc71;
font-size: 16px;
}
.box input[type = "text"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 16px; border: 2px solid
#3498db; padding: 10px 10px;
width: 200px; outline: none;
color: black; border-radius:
24px; transition: 0.25s; cursor:
pointer;
}
.box input[type = "text"]{ width:
280px; border-color: #2ecc71;
font-size: 16px;
}
.box input[type = "text"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 16px; border: 2px solid
#3498db; padding: 10px 10px;
width: 200px; outline: none;
color: black; border-radius:
24px; transition: 0.25s; cursor:
pointer;
}
.box input[type = "text"]{ width:
280px; border-color: white;
font-size: 16px;
}
.box input[type = "date"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 16px; border: 2px solid
#3498db; padding: 10px 10px;
width: 200px;
outline: none; color:
white; border-radius:
14px; transition: 0.25s;
cursor: pointer;
}
.box input[type = "date"]{ width:
280px; border-color: white;
font-size: 16px;
}
.box input[type = "submit"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 16px border: 2px solid
#2ecc71; padding: 14px 10px;
outline: none; color: white;
border-radius: 14px; transition:
0.25s; cursor: pointer;
}
.box input[type =
"submit"]:hover{ background:
#2ecc71; font-size: 16px;
}
.box1 input[type = "submit"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-size:
16px;
border: 2px solid #2ecc71;
padding: 8px 20px; outline:
none; color: white; border-
radius: 24px; transition: 0.25s;
cursor: pointer; top: 900px;
left: 70px;
}
.box1 input[type =
"submit"]:hover{ background: #2ecc71;
font-size: 16px;
}
</style> </head>
<body>
<form class="box" action="book.jsp" method="post">
<h1>RENT YOUR DREAM CAR....!</h1>
<input type="text" name="userid" placeholder="User ID">
<input type="text" name="carid" placeholder="CAR ID">
<input type="text" name="noofdays" placeholder="NUMBER OF DAYS">
<input type="date" name="bookdate" placeholder="BOOKDATE">
<input type="submit" value=" booknow">
</form>
<div style="position: fixed;top: 50px;right: 55px;">
<form class="box1" action="carcatalogue.html" method="post">
<input type="submit" value=" Back">
</form>
</div>
</body>
</html>
5.10 login.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title> Login </title>
<h2> Welcome.....! To Dream Cars House</h2>
<style> h2{
}
.box1 input[type =
"submit"]:hover{ background: #2ecc71;
font-size: 16px;
}
<body>
</style> </head>
<form class="box" action="login.jsp" method="post"> <h1>Login</h1>
</html>
5.11 pay.html
<!DOCTYPE html> <html>
<head>
<title>Credit Card</title>
<Style>
* { box-sizing : border-box;
}
body, html
{
height : 100%; min-height :
100%;
}
body {
margin : 0;
background-color : #e7e7e7; font-family
: 'Roboto', sans-serif;
}
/* Credit Card */
.credit-card { width : 360px; height : 400px;
margin : 60px auto 0; border : 1px solid #ddd;
border-radius : 6px; background-color : #fff; box-shadow
: 1px 2px 3px 0px rgba(0,0,0,0.10);
}
.form-header {
height : 60px; padding : 20px
30px 0; border-bottom : 1px solid
#E1E8EE;
}
/* Title */
.title { margin : 0;
color : #5e6977;
font-size : 18px; }
button {
cursor: pointer;
width : 100%; border-color
: transparent; border-radius :
6px; font-size : 16px;
}
5.13 register.html
<!DOCTYPE html>
<html>
<head>
<title>NEW REGISTRATION</title>
<style>
div {
position: fixed;
left: 260px; top:
300px; } body {
background-image: url('in.jpg'); background-repeat: no-
repeat; background-attachment: fixed; background-
size: 100% 100%;
margin: 0;
padding: 0;
}
.box { width: 500px;
height: 400px;
padding: 30px;
position: absolute;
top: 40%;
left: 40%; transform: translate(-50%,-
50%); text-align: center; cursor:
pointer;
}
.box h1{ color: white; text-
transform: uppercase; font-
weight: 500; font-size: 20px;
}
.box input[type = "text"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 18px; border: 2px solid
#3498db; padding: 9px 10px;
width: 200px; outline: none;
color: white; border-radius:
24px; transition: 0.25s; cursor:
pointer;
}
.box input[type = "text"]{ width:
280px; border-color: #2ecc71;
font-size: 16px;
}
.box input[type = "text"]
{ border:0; background:
none; display: block;
margin: 20px auto; text-
align: center; font-size:
18px; border: 2px solid
#3498db; padding: 10px
10px; width: 200px; outline:
none; color: white; border-
radius: 24px; transition:
0.25s; cursor: pointer;
}
.box input[type = "text"]{ width:
280px; border-color: #2ecc71;
font-size: 16px;
}
.box input[type = "text"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 18px; border: 2px solid
#3498db; padding: 10px 10px;
width: 200px; outline: none;
color: white; border-radius:
24px; transition: 0.25s; cursor:
pointer;
}
.box input[type = "text"]{ width:
280px; border-color: #2ecc71;
font-size: 16px;
}
.box input[type = "submit"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-
size: 18px border: 2px solid
#2ecc71; padding: 10px 40px;
outline: none; color: white;
border-radius: 24px; transition:
0.25s; cursor: pointer;
}
.box input[type =
"submit"]:hover{ background:
#2ecc71; font-size: 16px;
}
.box1 input[type = "submit"]
{ border:0; background: none;
display: block; margin: 20px
auto; text-align: center; font-size:
18px; border: 2px solid #2ecc71;
padding: 8px 10px; outline:
none; color: white; border-radius:
24px; transition: 0.25s; cursor:
pointer; top: 900px; left: 40px;
}
.box1 input[type = "submit"]:hover{ background: #2ecc71; font-size: 16px;
}
.box input[type = "text"],.box input[type = "password"]
{ border:0; background: none; display: block; margin: 20px
auto; text-align: center; font-size: 18px; border: 2px solid
#3498db; padding: 10px 10px; width: 200px; outline: none;
color: white; border-radius: 24px; transition: 0.25s; cursor:
pointer;
}
.box input[type = "text"]:focus,.box input[type = "password"]:focus{ width:
280px; border-color: #2ecc71; font-size: 16px;
}
</style> </head>
<body>
<div>
<form class="box" action="register.jsp" method="post">
<h1>REGISTERATION FORM....!</h1>
<input type="text" name="cname" placeholder="Name">
<input type="text" name="userid" placeholder="User ID">
<input type="text" name="mno" placeholder="Mobile Number">
<input type="text" name="lid" placeholder="License ID">
<input type="password" name="pass" placeholder="Password">
<input type="submit" value=" Register">
</form>
</div>
</div>
</body>
</html>