Java Project (MT)
Java Project (MT)
SYSTEM
GROUP MEMBER:-
MAYUR THORAT
SANMAY GOSAVI
SHREYA MALUNJKAR
UNDER GUIDENCE:-
PROF:-MRS.RUCHIKA CHAVAN
Aims/Benefits of the micro project
There are several benefits of working on a micro-project to create a bus
reservation system using Java. Some of the key benefits include:
● Practical application of Java programming: Developing a bus
reservation system using Java provides an opportunity to apply your Java
programming skills in a real- world scenario. It allows you to practice object-
oriented programming concepts, design patterns, and data structures in a
practical context.
● Understanding system design and architecture: Creating a bus
reservation system
involves designing and architecting various components such as user
interfaces, database management, ticket booking algorithms, and payment
processing. This project helps you gain insights into system design principles,
modularization, and component integration.
Enhancing problem-solving abilities:
Building a bus reservation system requires
analyzing complex requirements, breaking them down into
smaller tasks, and implementing effective solutions. This
process helps improve your problem-solving abilities,
critical thinking skills, and the ability to design efficient
algorithms.
Code:-
• import java.util.Scanner;
class Bus
{
private String busNumber;
private int totalSeats;
private int availableSeats;
public Bus(String busNumber, int totalSeats)
{
this.busNumber = busNumber;
this.totalSeats = totalSeats;
this.availableSeats = totalSeats;
}
public String getBusNumber()
{
return busNumber;
} public int getTotalSeats()
{
return totalSeats;
}
public int getAvailableSeats()
{
return availableSeats;
}
public boolean bookSeat()
{
if (availableSeats > 0)
{
availableSeats--;
return true;
}
else
{
}
return false; }
public void cancelSeat()
{
if (availableSeats < totalSeats
)
{
availableSeats++;
}
}
}
public class BusReservationSystem
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
Bus bus = new Bus("ABC123", 20); // Example bus with 20 seats
while (true)
{
System.out.println("1. Book a seat");
System.out.println("2. Cancel a seat");
System.out.println("3. Check available seats");
System.out.println("4. Exit");
System.out.print("Enter your choice: ");
int choice = scanner.nextInt();
switch (choice)
{
case 1:
if (bus.bookSeat())
{
System.out.println("Seat booked successfully!");
}
else
{
System.out.println("Sorry, no seats available.");
}
break;
case 2:
bus.cancelSeat();
System.out.println("Seat cancelled successfully!");
break;
case 3:
System.out.println("Available seats: " + bus.getAvailableSeats());
break;
case 4:
System.out.println("Thank you for using our system. Goodbye!");
System.exit(0);
break;
default:
System.out.println("Invalid choice. Please try again.");
}
}
}
}
OUTPUT-:
Conclusion-:
In conclusion, the micro-project on creating a bus reservation system
using Java provides a valuable learning experience and practical
application of various programming and software development concepts.
Through this project, you have gained hands-on experience in
implementing object-oriented programming, designing system
architecture, working with databases, and creating user interfaces. You
have also developed skills in problem-solving, project management, and
collaboration. The bus reservation system you have built can find
applications in various industries such as bus companies, travel agencies,
online ticketing platforms, public transportation authorities, educational
institutions, and tour operators. It enables efficient and convenient bus
ticket booking, schedule management, and resource allocation.
By successfully completing this micro-project, you have demonstrated your
ability to analyze requirements, design and implement software solutions,
conduct testing and debugging, and document your work. These skills are
valuable in the field of software development and can be applied to other
projects and scenarios.
Overall, this micro-project has provided you with a practical opportunity to
apply your Java programming skills, enhance your understanding of software
development methodologies, and develop a working bus reservation system
that can be used in real-world applications. It serves as a stepping stone to
further advance your programming abilities and prepares you for more
complex software development projects in the future.
THANK YOU!..........^_^