Question

In: Computer Science

Creat a theater booking system in java language using : 1.OOP objects -Classes 2.encapsulation 3.polymorphism 4.inheritance...

Creat a theater booking system in java language using :

1.OOP objects -Classes
2.encapsulation
3.polymorphism
4.inheritance
5.abstract class

Solutions

Expert Solution

=================== simple java program for theater ticket booking ==================

import java.util.Scanner;

//class and encapsulation
class BookTheTicket {

private String movieName;
private String theatreName;

private int ticketCost;

void myAllmovies() {

System.out.println("-------Listing the movies:------");
System.out.println(" 1.DDLJ ------------ $40 \n 2.kkr---------$.50 \n 3.game-movie --------$60 \n 4.fun movie ----- $.70 ");


}

}
// inheritence
class theater extends BookTheTicket{
private int numOfTickets;
void theater() {
System.out.println("*******Listing the theatre:******* \n 1.coco cola tld \n 2.koi gandhi kr");
int k;
int an;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if (n == 1) {
System.out.println("*******coco cola tld theater*******");
System.out.println("*******choose a movie name*******");
System.out.println("------Listing the movie:------\n 1.DDLJ \n 2.kkr ");
int monum = sc.nextInt();
if (monum == 1) {
System.out.println("DDLJ new movie @ coco cola tld theater");
System.out.println("Enter how many ticket to be booked:---");
int r = sc.nextInt();
int left= numOfTickets-r;
int amount=40*r;
System.out.println("press 1 to continue booking ticket----");
int h = sc.nextInt();
System.out.println("\n\n\n");
if (h == 1) {
System.out.println("******************************************************");
System.out.println("theater ------------------- coco cola tld theater");
System.out.println("movie --------------------- DDLJ");
System.out.println("cost ---------------------- $"+amount);
System.out.println("******************************************************");
}

}
if (monum == 2) {
System.out.println("kkr @ coco cola tld theater");
System.out.println("Enter how many ticket to be booked:---");
int r = sc.nextInt();
int left= numOfTickets-r;
int amount=50*r;
System.out.println("press 1 to continue booking ticket----");

int h = sc.nextInt();
System.out.println("\n\n\n");
if (h == 1) {
System.out.println("******************************************************");
System.out.println("theater ------------------- coco cola tld");
System.out.println("movie --------------------- kkr");
System.out.println("cost ---------------------- Rs"+amount);
System.out.println("******************************************************");
}

}

}
if (n == 2) {
System.out.println("*******koi gandhi kr theater*******");
System.out.println("*******choose a movie name*******");
System.out.println("------Listing the movie:------\n 1.DDLJ \n 2.kkr ");
int p = sc.nextInt();
int monum = sc.nextInt();
if (monum == 1) {
System.out.println("game-movie @ koi gandhi kr theater");
System.out.println("Enter how many ticket to be booked:---");

int r = sc.nextInt();
int left= numOfTickets-r;
int amount=60*r;
System.out.println("press 1 to continue booking ticket----");

int h = sc.nextInt();
System.out.println("\n\n\n");
if (h == 1) {
System.out.println("******************************************************");
System.out.println("theater ------------------- koi gandhi kr");
System.out.println("movie --------------------- game-movie");
System.out.println("cost ---------------------- Rs."+amount);
System.out.println("******************************************************");
}

}
if (monum== 2) {
System.out.println("fun movie @ koi gandhi kr theater");
System.out.println("Enter how many ticket to be booked:---");
  
int r = sc.nextInt();
int left= numOfTickets-r;
int amount=70*r;
System.out.println("press 1 to continue booking ticket----");

int h = sc.nextInt();
System.out.println("\n\n\n");
if (h == 1) {
System.out.println("******************************************************");
System.out.println("theater ------------------- koi gandhi kr ");
System.out.println("movie --------------------- fun movie");
System.out.println("cost ---------------------- Rs."+amount);
System.out.println("******************************************************");
}

}
}

}
}

public class Main {

public static void main(String[] args) {
BookTheTicket ob1 = new BookTheTicket();

BookTheTicket [] moviename = new BookTheTicket[2];
moviename[0] = ob1;
theater ob2 = new theater();
moviename[1] = ob2;

System.out.println("@@@@@@@@@@ hello @@@@@@@@@@@@@ customer @@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
System.out.println("---------1.list of movies and their prices--------- \n-------2.acces and book tickets through theaters---");

System.out.println("\n@@@@@@@@@@ thanks @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
Scanner d = new Scanner(System.in);
int h = d.nextInt();
switch (h) {
case 1: {
ob1.myAllmovies();
break;
}
case 2: {

ob2.theater();
}
}

}

}

------------------------------------------------------------------------------- end -----------------------------------------------------

=============== screenshots of the code and the output================================

======================== end ====================================================

===-------- PLEASE LIKE THE POST ----==========


Related Solutions

This is for a java program. Payroll System Using Inheritance and Polymorphism 1. Implement an interface...
This is for a java program. Payroll System Using Inheritance and Polymorphism 1. Implement an interface called EmployeeInfo with the following constant variables: FACULTY_MONTHLY_SALARY = 6000.00 STAFF_MONTHLY_HOURS_WORKED = 160 2. Implement an abstract class Employee with the following requirements: Attributes last name (String) first name (String) ID number (String) Sex - M or F Birth date - Use the Calendar Java class to create a date object Default argument constructor and argument constructors. Public methods toString - returning a string...
(In Java) Inheritance Shapes: Write 5 Classes: 1) Shapes    2) Triangle 3) Rectangle    4)...
(In Java) Inheritance Shapes: Write 5 Classes: 1) Shapes    2) Triangle 3) Rectangle    4) Circle 5) TestAllShapes (create 1 object of each type and print the Area for each of them.)
This is Python programming Focus 1. Classes and Objects 2. Creating objects 3. Manipulating objects This...
This is Python programming Focus 1. Classes and Objects 2. Creating objects 3. Manipulating objects This lab maps to learning the following objectives: Write a working program that creates a Class, Instances of Objects from that Class, and Functions that use Objects as parameters. For this portion of the lab, you will create a new program for your Professor. Create a class named Student that holds the following data about a student: 1. Name 2. Student ID number 3. GPA...
Implementation Requirements: 1. Inheritance 2. Polymorphism 3. Linked List with appropriate payload 4. UML Diagrams (pre-coding...
Implementation Requirements: 1. Inheritance 2. Polymorphism 3. Linked List with appropriate payload 4. UML Diagrams (pre-coding design) Project Problem Domain: Write a program that tracks the faculty's information, such as id, names, rank, and number of allowed courses if the faculty is an adjunct. The hierarchy will be based on an abstract class Faculty and two derived classes, Professor and Adjunct. For this project, you will store all instances of faculty in a linked list! Have your program allow the...
Using Java language (in program NetBeans). 1) Using a 2 dimensional array Your company has 4...
Using Java language (in program NetBeans). 1) Using a 2 dimensional array Your company has 4 grocery stores. Each store has 3 departments where product presentation affects sales (produce, meat, frozen). Every so often a department in a store gets a bonus for doing a really good job. You need to create a program that keeps a table of bonuses in the system for departments. Create a program that has a two dimensional array for these bonuses. The stores can...
By using Java language, Complete the StackArray.java by using.stackArrayDemo.java. 1.Read the StackArrayDemo.java. 2. Use the demo...
By using Java language, Complete the StackArray.java by using.stackArrayDemo.java. 1.Read the StackArrayDemo.java. 2. Use the demo to complete StackArray.java StackArrayDemo.java: public class StackArrayDemo { public static void main(String [] args) { StackArray a = new StackArray(); int score = 0; if (a.peek() == null) score += 10; else System.out.println("Check peek()"); a.push("Orange"); System.out.println(a); a.push("Apple"); System.out.println(a); a.push("Guava"); System.out.println(a); if (a.peek().equals("Guava")) score += 10; else System.out.println("Check push()"); a.pop(); System.out.println(a); a.pop(); System.out.println(a); if (a.peek().equals("Orange")) score += 10; else System.out.println("Check pop()"); a.push("Mango"); System.out.println(a); if (a.getStackSize()...
Using C Language Write a program segment that computes 1 + 2 + 3 + ......
Using C Language Write a program segment that computes 1 + 2 + 3 + ... + ( n - 1) + n , where n is a data value. Follow the loop body with an if statement that compares this value to (n * (n + 1)) / 2 and displays a message that indicates whether the values are the same or different. Please give me code to just copy and paste
PA4-2 Assigning Costs Using Traditional System, Assigning Costs Using Activity Proportions [LO 4-1, 4-3, 4-5, 4-6]...
PA4-2 Assigning Costs Using Traditional System, Assigning Costs Using Activity Proportions [LO 4-1, 4-3, 4-5, 4-6] Carlise Corp., which manufactures ceiling fans, currently has two product lines, the Indoor and the Outdoor. Carlise has total overhead of $133,810. Carlise has identified the following information about its overhead activity cost pools and the two product lines: Activity Cost Pools Cost Driver Cost Assigned to Pool Quantity/Amount Consumed by Indoor Line Quantity/Amount Consumed by Outdoor Line Materials handling Number of moves $...
Java language 1. Sort any 10 keys using Min Heap. 2. Sort any 10 keys using...
Java language 1. Sort any 10 keys using Min Heap. 2. Sort any 10 keys using Max Heap.
Java language 1. Sort any 10 keys using Min Heap. 2. Sort any 10 keys using...
Java language 1. Sort any 10 keys using Min Heap. 2. Sort any 10 keys using Max Heap.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT