Question

In: Computer Science

Just need java code for a small business that books shows and gives out a receipt...

Just need java code for a small business that books shows and gives out a receipt after placing order on what show they want

Solutions

Expert Solution

We need to design an online Movie ticket booking system where a user can search a movie in a given city and book it.This article will explain you the architecture of the booking system.

How to implement seat booking process?

Solution :

The Main Classes to be used for the user personas :

  • User
  • Movie
  • Theater
  • Booking
  • Address
  • Facilities

// Java skeleton code to design an online movie
// booking system.
Enums :

   public enum SeatStatus {
   SEAT_BOOKED,
   SEAT_NOT_BOOKED;
}

public enum MovieStatus {
   Movie_Available,
   Movie_NotAvailable;
}

public enum MovieType {
   ENGLISH,
   HINDI;
}

public enum SeatType {
   NORMAL,
   EXECUTIVE,
   PREMIUM,
   VIP;
}

public enum PaymentStatus {
   PAID,
   UNPAID;
}

class User {

   int userId;
   String name;
   Date dateOfBirth;
   String mobNo;
   String emailId;
   String sex;
}

class Movie {

   int movieId;
   int theaterId;
   MovieType movieType;
   MovieStatus movieStatus;
}

class Theater {

   int theaterId;
   String theaterName;
   Adress adress;

   List<Movie> movies;
   float rating;
}

class Booking {
   int bookingId;
   int userId;
   int movieId;
   List<Movie> bookedSeats;
   int amount;
   PaymentStatus status_of_payment;
   Date booked_date;
   Time movie_timing;
}

class Address {

   String city;
   String pinCode;
   String state;
   String streetNo;
   String landmark;
}
This is an OOP design question, so full code is not required. The above code has classes and attributes only. In the above code, as you can see enums are self-explanatory.
We have users class in which users details are kept.
Theater class in which name of the theater, it’s address and list of movies currently running are kept.
Booking class lets you book the seat in a particular theater. It keeps a reference in Movie, Payment class.

How to handle the cases where two persons are trying to access the same seat almost same time?

Lets take SeatBook and Transactions class which will be called from the main class. Here from the above code, We expand a bit the payment process which is not shown in the above code. In SeatBook class we will have reference to Transaction class also.

Now to ensure when two persons are trying to access the same seat almost at the same time then we would use Synchronized method of Thread class and will call a thread belong to each log in user.

Class SeatBook
{
   Transaction transaction_obj;
   bool seats[total_seats];
   String place;
   String ticketType;

   bool check_availability();

   int position_of_seat()
   {
       return seat_pos_in_theator;
   }

   void multiple tickets();

   void final_booking()
   {
       place = positon_of_seat();
       if (single_ticket)
           continue;
       else
           mutliple_ticket_booking();

       Transaction_obj.pay(ticketType, seats_booked, place);
   }
}

Note: Plzzz don' t give dislike.....Plzzz comment if u have any problem i will try to resolve it.......


Related Solutions

Need Java code for a small business for booking on various circus shows / online shows...
Need Java code for a small business for booking on various circus shows / online shows because of covid Just need template I will add prices in my self
I need original java code that completes this program and gets it to print out results...
I need original java code that completes this program and gets it to print out results just like in the example. Also please upload answer in a word document format only. Implement both linear search and binary search, and see which one performs better given an array 1,000 randomly generated whole numbers (between 0-999), a number picked to search that array at random, and conducting these tests 20 times. Each time the search is conducted the number of checks (IE...
Programming Java Homework: Find the Highest Score (Just need the code and directions followed exactly and...
Programming Java Homework: Find the Highest Score (Just need the code and directions followed exactly and written in Java code) Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the name and score of the student with the highest score. Use the next () method in the Scanner class to read a name, rather than using the nextLine () method.
JAVA JAVA JAVA Hey i need to find a java code for my homework, this is...
JAVA JAVA JAVA Hey i need to find a java code for my homework, this is my first java homework so for you i don't think it will be hard for you. (basic stuff) the problem: Write a complete Java program The transport Company in which you are the engineer responsible of operations for the optimization of the autonomous transport of liquid bulk goods, got a design contract for an automated intelligent transport management system that are autonomous trucks which...
**NEED ACTUAL JAVA CODE** Basically this code is defining the board for the game tigers and...
**NEED ACTUAL JAVA CODE** Basically this code is defining the board for the game tigers and goats or 'Bagh chan'. Ive posted the other 3 classes that I need help with, didnt want to put all 4 in one question. public class GameViewer implements MouseListener { // instance variables private int bkSize; // block size - all other measurements to be derived from bkSize private int brdSize; // board size private SimpleCanvas sc; // an object of SimpleCanvas to draw...
**NEED ACTUAL JAVA CODE** Basically this code is defining the board for the game tigers and...
**NEED ACTUAL JAVA CODE** Basically this code is defining the board for the game tigers and goats or 'Bagh chan'. Ive posted the other 3 classes that I need help with, didnt want to put all 4 in one question. /** * Maintains and updates the status of the board * i.e. the locations of goats and tigers * * @Student 1 Name: * @Student 1 Number: * * @Student 2 Name: * @Student 2 Number: */ public class Board...
I need a full java code. And I need it in GUI With the mathematics you...
I need a full java code. And I need it in GUI With the mathematics you have studied so far in your education you have worked with polynomials. Polynomials are used to describe curves of various types; people use them in the real world to graph curves. For example, roller coaster designers may use polynomials to describe the curves in their rides. Polynomials appear in many areas of mathematics and science. Write a program which finds an approximate solution to...
I need an idea of Java code that will convert an integer (1 to 3,999) into...
I need an idea of Java code that will convert an integer (1 to 3,999) into roman numerals using if statements; arrays and loops sadly aren't allowed and that's all I can come up with.
//Complete the incomplete methods in the java code //You will need to create a driver to...
//Complete the incomplete methods in the java code //You will need to create a driver to test this. public class ManagedArray { private int[] managedIntegerArray; //this is the array that we are managing private int maximumSize; //this will hold the size of the array private int currentSize = 0; //this will keep track of what positions in the array have been used private final int DEFAULT_SIZE = 10; //the default size of the array public ManagedArray()//default constructor initializes array to...
I need this code translated from C++ to Java. Im personally still trying to learn Java,...
I need this code translated from C++ to Java. Im personally still trying to learn Java, so if you can include screenshots of your IDE/output that would be helpful. Much appreciated! #include <iostream> #include <string> using namespace std; class pizza { public:    string ingrediants, address;    pizza *next;    pizza(string ingrediants, string address)    {        this->address = address;        this->ingrediants = ingrediants;        next = NULL;    } }; void enqueue(pizza **head, pizza **tail, pizza...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT