WAD JAVA Assignment 2 DEMO
WAD JAVA Assignment 2 DEMO
ASSIGNMENT-2
HIRITHIK RAJ SINGH.P 717821S115
JAYAKUMAR M 717821S117
1
THE RENT CAR SERVICE
ABSTRACT
Car rental services are in high demand, both for business and personal travel. A well-designed car rental
system can help businesses to operate more efficiently and provide better customer service. This project
aims to develop a comprehensive car rental system that will automate many of the manual tasks
involved in car rental management, such as vehicle reservation, customer check-in/check-out, and
billing. The system will also provide a web portal for customers to book vehicles online and manage
their reservations.
The system will be designed to be scalable and flexible, so that it can be easily adapted to meet the
needs of different car rental businesses. It will also be integrated with other systems, such as accounting
and payment processing systems.
2
CODE:
Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>HRSRent</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Poppins:400,600,700&display=swap"
rel="stylesheet">
<body class="sub_page">
<div class="hero_area">
<header class="header_section">
<div class="container-fluid">
<nav class="navbar navbar-expand-lg custom_nav-container">
<a class="navbar-brand" href="index.html">
<span>
HRSRent
</span>
</a>
3
</a>
</div>
<div class="custom_menu-btn">
<button onclick="openNav()">
<span class="s-1"> </span>
<span class="s-2"> </span>
<span class="s-3"> </span>
</button>
</div>
<div id="myNav" class="overlay">
<div class="overlay-content">
<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="car.html">Cars</a>
<a href="blog.html">Blog</a>
<a href="contact.html">Contact Us</a>
<a href="login.html">Login</a>
</div>
</div>
</div>
</nav>
</div>
</header>
</div>
4
</div>
<div class="d-flex justify-content-center">
<button type="submit" class="">Send</button>
</div>
</form>
</div>
</div>
</div>
<div class="contact_items">
<a href="">
<div class="img-box">
<img src="images/location.png" alt="">
</div>
<h6>
Coimbatore Tamilnadu
</h6>
</a>
<a href="">
<div class="img-box">
<img src="images/call.png" alt="">
</div>
<h6>
(+91 7395816093)
</h6>
</a>
<a href="">
<div class="img-box">
<img src="images/mail.png" alt="">
</div>
<h6>
[email protected]
</h6>
</a>
</div>
<div class="social_container">
<div class="social-box">
<div>
<a href="https://instagram.com/p.hirithikraj?utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
<img src="images/fb.png" alt="https://instagram.com/p.hirithikraj?
utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
</a>
</div>
<div>
<a href="https://www.linkedin.com/in/hirithik-raj-singh-788b30255">
<img src="images/linkedin.png" alt="https://www.linkedin.com/in/hirithik-raj-singh-788b30255">
</a>
</div>
<div>
<a href="https://instagram.com/p.hirithikraj?utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
5
<img src="images/insta.png" alt="https://instagram.com/p.hirithikraj?
utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
</a>
</div>
</div>
</div>
</div>
</section>
</p>
</footer>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js">
</script>
<script src="js/custom.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>HRSRent</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Poppins:400,600,700&display=swap"
rel="stylesheet">
6
<body>
<div class="hero_area">
<header class="header_section">
<div class="container-fluid">
<nav class="navbar navbar-expand-lg custom_nav-container">
<a class="navbar-brand" href="index.html">
<span>
HRSRent
</span>
</a>
7
Rent Car <br>
Experts <br>
Service
</h1>
<a href="">
Contact Us
</a>
</div>
</div>
<div class="carousel-item">
<div class="detail-box">
<h1>
Rent Car <br>
Experts <br>
Service
</h1>
<a href="">
Contact Us
</a>
</div>
</div>
<div class="carousel-item">
<div class="detail-box">
<h1>
Rent Car <br>
Experts <br>
Service
</h1>
<a href="">
Contact Us
</a>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</section>
</div>
<section class="book_section">
<div class="form_container">
<form action="">
<div class="form-row">
<div class="col-lg-8">
8
<div class="form-row">
<div class="col-md-6">
<label for="parkingName">Pick Up Location</label>
<input type="text" class="form-control" placeholder="location">
</div>
<div class="col-md-6">
<label for="parkingNumber">Drop Location</label>
<input type="text" class="form-control" placeholder="location">
</div>
</div>
<div class="form-row">
<div class="col-md-6">
<label for="parkingName">Pick Up Date</label>
<input type="text" class="form-control" placeholder="07/08/2023">
</div>
<div class="col-md-6">
<label for="parkingNumber">Return Date</label>
<input type="text" class="form-control" placeholder="08/08/2023">
</div>
</div>
</div>
<div class="col-lg-4">
<div class="btn-container">
<button type="submit" class="">
Search
</button>
</div>
</div>
</div>
</form>
</div>
<div class="img-box">
<img src="images/book-car.png" alt="">
</div>
</section>
9
<img src="images/c-1.png" alt="">
</div>
<div class="detail-box">
<h5>
Choose Your Car
</h5>
<p>
Choosing a car involves several steps to ensure you select a vehicle that fits your needs, preferences, and lifestyle.
</p>
<a href="">
Read More
</a>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/c-2.png" alt="">
</div>
<div class="detail-box">
<h5>
Get Your Car
</h5>
<p>
Getting a car involves several steps, from researching and selecting the right model to completing the purchase
process.
</p>
<a href="">
Read More
</a>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/c-3.png" alt="">
</div>
<div class="detail-box">
<h5>
Contact Your Dealer
</h5>
<p>
Look up the car dealer's contact information. This can usually be found on the dealer's website, through online
directories, or in advertisements.
<a href="">
Read More
</a>
</div>
</div>
</div>
</div>
</section>
10
<section class="about_section layout_padding-bottom">
<div class="container-fluid">
<div class="row">
<div class="col-md-7 px-0">
<div class="img-box">
<img src="images/about-img.png" alt="">
</div>
</div>
<div class="col-md-4 col-lg-3">
<div class="detail-box">
<h2>
About Our Cars
</h2>
<p>
Make note of the specific car you're interested in. If you have a stock number, VIN (Vehicle Identification
Number), or any other unique identifier for the car, that can help the dealership locate the exact vehicle you're asking
about.
</p>
<a href="">
Read More
</a>
</div>
</div>
</div>
</div>
</section>
<section class="best_section">
<div class="container">
<div class="book_now">
<div class="detail-box">
<h2>
Our Best Cars
</h2>
<p>
Start by visiting the dealership's official website. Many dealerships highlight their best-selling or featured models
on their website's homepage or inventory page.
</p>
</div>
<div class="btn-box">
<a href="">
Book Now
</a>
</div>
</div>
</div>
</section>
11
<div class="rent_container">
<div class="box">
<div class="img-box">
<img src="images/r-1.png" alt="">
</div>
<div class="price">
<a href="">
Rent ₹3000
</a>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/r-2.png" alt="">
</div>
<div class="price">
<a href="">
Rent ₹500
</a>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/r-3.png" alt="">
</div>
<div class="price">
<a href="">
Rent ₹1500
</a>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/r-4.png" alt="">
</div>
<div class="price">
<a href="">
Rent ₹2000
</a>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/r-5.png" alt="">
</div>
<div class="price">
<a href="">
Rent ₹500
</a>
</div>
</div>
12
<div class="box">
<div class="img-box">
<img src="images/r-6.png" alt="">
</div>
<div class="price">
<a href="">
Rent ₹1500
</a>
</div>
</div>
</div>
<div class="btn-box">
<a href="">
See More
</a>
</div>
</div>
</section>
13
</div>
</div>
</div>
<div class="item">
<div class="box">
<div class="date-box">
<h6>
08/08/2023
</h6>
</div>
<div class="img-box">
<img src="C:\Users\hirithik\Downloads\steering wheel images.jpeg" alt="">
</div>
<div class="detail-box">
<h5>
Steering wheels
</h5>
<p>
Today, roughly a third of the world's countries, including India and Japan, drive on the left in cars with
steering wheels on the right. </p>
</div>
</div>
</div>
<div class="item">
<div class="box">
<div class="date-box">
<h6>
07/08/2023
</h6>
</div>
<div class="img-box">
<img src="C:\Users\hirithik\Downloads\buick eight vintage car.jpg" alt="">
</div>
<div class="detail-box">
<h5>
Buick Car
</h5>
<p>
Buick is an American automobile brand that has been in existence since 1903. It is currently owned by
General Motors. Buick cars are known for their luxury and comfort. However, Buick cars are not currently sold in India.
</p>
</div>
</div>
</div>
<div class="item">
<div class="box">
<div class="date-box">
<h6>
08/08/2023
</h6>
</div>
14
<div class="img-box">
<img src="C:\Users\hirithik\Downloads\steering wheel images.jpeg" alt="">
</div>
<div class="detail-box">
<h5>
Steering wheels
</h5>
<p>
The price of steering wheels in India varies depending on the make, model, and features of the steering wheel.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</footer>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js">
</script>
<script src="js/custom.js"></script>
<section class="us_section">
<div class="container">
<div class="heading_container">
<h2>
Why choose Us
</h2>
<p>
They are often choose a brand known for producing reliable vehicles that require fewer repairs and have a lower
likelihood of breaking down. A strong track record of dependability can be a significant factor in their decision.
</p>
</div>
</div>
<div class="us_container layout_padding2">
<div class="content_box">
<div class="box">
<div class="img-box">
<img src="images/u-1.png" alt="">
</div>
<div class="detail-box">
<h5>
Low Rent
</h5>
15
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/u-2.png" alt="">
</div>
<div class="detail-box">
<h5>
Fast Car
</h5>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/u-3.png" alt="">
</div>
<div class="detail-box">
<h5>
Safe Car
</h5>
</div>
</div>
<div class="box">
<div class="img-box">
<img src="images/u-4.png" alt="">
</div>
<div class="detail-box">
<h5>
Quick Support
</h5>
</div>
</div>
</div>
<div class="btn-box">
<a href="">
Read More
</a>
</div>
</div>
</section>
16
</p>
</div>
<div class="layout_padding2-top">
<div class="carousel-wrap ">
<div class="owl-carousel">
<div class="item">
<div class="box">
<div class="detail-box">
<p>
It is a long established fact that a reader will be distracted by the readable content of a page when looking at
its layout. The point of using Lorem It is a long established fact that a reader will be distracted by the readable content of a
page when looking at its layout. The point of using Lorem
</p>
</div>
<div class="client_id">
<div class="img-box">
<img src="images/client-1.png" alt="" class="img-1">
<img src="images/client-1-white.png" alt="" class="img-2">
</div>
<div class="name">
<h6>
Established
</h6>
<p>
by the readable
</p>
</div>
</div>
</div>
</div>
<div class="item">
<div class="box">
<div class="detail-box">
<p>
It is a long established fact that a reader will be distracted by the readable content of a page when looking at
its layout. The point of using Lorem It is a long established fact that a reader will be distracted by the readable content of a
page when looking at its layout. The point of using Lorem
</p>
</div>
<div class="client_id">
<div class="img-box">
<img src="images/client-2.png" alt="" class="img-1">
<img src="images/client-2-white.png" alt="" class="img-2">
</div>
<div class="name">
<h6>
Blished
</h6>
<p>
by the readable
</p>
17
</div>
</div>
</div>
</div>
<div class="item">
<div class="box">
<div class="detail-box">
</div>
<div class="client_id">
<div class="img-box">
<img src="images/client-1.png" alt="" class="img-1">
<img src="images/client-1-white.png" alt="" class="img-2">
</div>
<div class="name">
<h6>
Establi
</h6>
<p>
by the readable
</p>
</div>
</div>
</div>
</div>
<div class="item">
<div class="box">
<div class="detail-box">
<p>
It is a long established fact that a reader will be distracted by the readable content of a page when looking at
its layout. The point of using Lorem It is a long established fact that a reader will be distracted by the readable content of a
page when looking at its layout. The point of using Lorem
</p>
</div>
<div class="client_id">
<div class="img-box">
<img src="images/client-1.png" alt="" class="img-1">
<img src="images/client-1-white.png" alt="" class="img-2">
</div>
<div class="name">
<h6>
Establi
</h6>
<p>
by the readable
</p>
</div>
</div>
</div>
</div>
</div>
</div>
18
</div>
</div>
</section>
<a href="">
<div class="img-box">
<img src="images/location.png" alt="">
</div>
<h6>
Coimbatore Tamilnadu
</h6>
</a>
<a href="">
<div class="img-box">
19
<img src="images/call.png" alt="">
</div>
<h6>
(+91 7395816093)
</h6>
</a>
<a href="">
<div class="img-box">
<img src="images/mail.png" alt="">
</div>
<h6>
[email protected]
</h6>
</a>
</div>
<div class="social_container">
<div class="social-box">
<div>
<a href="https://instagram.com/p.hirithikraj?utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
<img src="images/fb.png" alt="https://instagram.com/p.hirithikraj?
utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
</a>
</div>
<div>
<a href="https://www.linkedin.com/in/hirithik-raj-singh-788b30255">
<img src="images/linkedin.png" alt="https://www.linkedin.com/in/hirithik-raj-singh-788b30255">
</a>
</div>
<div>
<a href="https://instagram.com/p.hirithikraj?utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
<img src="images/insta.png" alt="https://instagram.com/p.hirithikraj?
utm_source=qr&igshid=MzNlNGNkZWQ4Mg%3D%3D">
</a>
</div>
</div>
</div>
</div>
</section>
<section class="map_section">
<div class="map_container">
<div class="map-responsive">
</div>
</div>
</section>
20
Registration:
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "username")
private String username;
@Column(name = "password")
private String password;
// UserRepository interface
public interface UserRepository extends JpaRepository<User, Long> {
User findByUsername(String username);
}
// UserService class
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
21
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "username")
private String username;
@Entity
@Table(name = "cars")
public class Car {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "model")
private String model;
@Column(name = "available")
private boolean available;
@Entity
@Table(name = "bookings")
public class Booking {
22
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
@ManyToOne
@JoinColumn(name = "car_id")
private Car car;
@Column(name = "booking_status")
private String bookingStatus;
try {
// Example: Create and persist a user
entityManager.getTransaction().begin();
entityManager.persist(user);
23
entityManager.getTransaction().commit();
entityManager.persist(car);
entityManager.getTransaction().commit();
entityManager.persist(booking);
entityManager.getTransaction().commit();
} finally {
entityManager.close();
entityManagerFactory.close();
}
}
}
24
Rent Car Booking:
@Entity
@Table(name = "cars")
public class Car {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "model")
private String model;
@Column(name = "available")
private boolean available;
// CarRepository interface
public interface CarRepository extends JpaRepository<Car, Long> {
List<Car> findByAvailableTrue();
}
// Booking class
@Entity
@Table(name = "bookings")
public class Booking {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
25
@ManyToOne
@JoinColumn(name = "car_id")
private Car car;
@Column(name = "booking_status")
private String bookingStatus;
// BookingRepository interface
public interface BookingRepository extends JpaRepository<Booking, Long> {
List<Booking> findByUser(User user);
}
// BookingService class
@Service
public class BookingService {
@Autowired
private BookingRepository bookingRepository;
bookingRepository.save(booking);
}
}
26
Booking Completion Message:
// Your logic to update booking status when the booking is completed
if (optionalBooking.isPresent()) {
Booking booking = optionalBooking.get();
booking.setBookingStatus("Completed");
bookingRepository.save(booking);
27
OUTPUTS
INDEX PAGE
CONFIRMATION MESSAGE:
28
DETAILS PAGE
CONCLUSION:
• This project demonstrates the basic structure of a student profile management system
with a focus on integrating Hibernate ORM, HTML, and Servlets.
• We can extend and enhance the project by adding validation, updating, and deleting
functionality, as well as error handling and additional features as needed.
• It's important to configure your database connection, Hibernate settings, and servlet
mappings in your project's configuration files (e.g., hibernate.cfg.xml, web.xml) and
include the necessary dependencies (JAR files) for Hibernate and your chosen
application server.
• Customization and additional functionality can be implemented based on the specific
requirements of our project.
29
THANK YOU
30