Question

creat a simple theater booking system with java language using: 1. oop objects - classes 2....

creat a simple theater booking system with java language using:

1. oop objects - classes
2. encapsulation
3. inheritance
4. polymorphism
5. abstract class

0 0
Add a comment Improve this question Transcribed image text
Answer #1
class CompareEntertainmentsUsingInheritance {     public static void main(String arg[])     {         Movie julai = new Movie();         julai.name = "Julai";         julai.director = "Trivikram";         julai.stuntMaster = "Peter Hein";         julai.numberOfArtists = 57;         julai.releaseDate = "15-Aug-2012";                  julai.collectionsFirstWeek = 215467.8;         julai.collectionsRestOfTheDays = 541132.5;                  Drama ramayan = new Drama();         ramayan.name = "Ramayana";         ramayan.writer = "Valmiki";         ramayan.stageSetter = "Anjaneya";         ramayan.numberOfArtists = 200000;         ramayan.releaseDate = "17-Mar-1659 BC";                  ramayan.collectionsFirstWeek = 3282937242.86;         ramayan.collectionsRestOfTheDays = 93488272349.51;                           Circus jumbo = new Circus();         jumbo.name = "Jumbo";         jumbo.ringMaster = "Antony";         jumbo.numberOfArtists = 316;         jumbo.releaseDate = "16-Dec-1997";                  jumbo.collectionsFirstWeek = 2123132.21;         jumbo.collectionsRestOfTheDays = 234936725.09;                  if((jumbo.getTotalCollections() > julai.getTotalCollections()) && (jumbo.getTotalCollections() > ramayan.getTotalCollections()))         {             jumbo.print();         }         else if (julai.getTotalCollections() > ramayan.getTotalCollections())         {             julai.print();         }         else         {             ramayan.print();         }          } } class Entertainment {     String name;     int numberOfArtists;     String releaseDate;     double collectionsFirstWeek;     double collectionsRestOfTheDays;     double getTotalCollections()     {         return collectionsFirstWeek + collectionsRestOfTheDays;     }     void printEntertainment()     {         System.out.println( name + " got the following collections " );         System.out.println("First Week : " + collectionsFirstWeek);         System.out.println("Rest Of The Days : " + collectionsRestOfTheDays);         System.out.println("Total Collections : " + getTotalCollections());         System.out.println("Total Artists : " + numberOfArtists);         System.out.println("Release Date : " + releaseDate);     } } class Movie extends Entertainment {     String director;     String stuntMaster;     void print()     {         printEntertainment();         System.out.println("Director : " + director);         System.out.println("Stunt Master : " + stuntMaster);     } } class Drama extends Entertainment {     String writer;     String stageSetter;     void print()     {         printEntertainment();         System.out.println("Writer : " + writer);         System.out.println("Stage Setter : " + stageSetter);     } } class Circus extends Entertainment {     String ringMaster;     void print()     {         printEntertainment();         System.out.println("Ring Master : " + ringMaster);     } }
Add a comment
Know the answer?
Add Answer to:
creat a simple theater booking system with java language using: 1. oop objects - classes 2....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need a simple java program that contains all the following subjects : 1- OOP Objects...

    I need a simple java program that contains all the following subjects : 1- OOP Objects -Classes 2- Encapsulation 3- Polymorphism 4-Inheritance 4- Abstract Classes

  • Question 2: Create a simple pixelated snake game with a start button and a score for...

    Question 2: Create a simple pixelated snake game with a start button and a score for each fruit you eat. If you touch the borders go back to the start scene. You must complete this question using true OOP with classes: - inheritance - polymorphism - encapsulation

  • I have this java program that I need to add an abstract method and polymorphism to...

    I have this java program that I need to add an abstract method and polymorphism to it : 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...

  • You are given a specification for some Java classes as follows.   A building has a number...

    You are given a specification for some Java classes as follows.   A building has a number of floors, and a number of windows. A house is a building. A garage is a building. (This isn’t Florida-like … it’s a detached garage.) A room has a length, width, a floor covering, and a number of closets. You can never create an instance of a building, but every object that is a building must have a method that calculates the floor space,...

  • which are true? 1. all high level programming language support objects, classes or structs 2. java...

    which are true? 1. all high level programming language support objects, classes or structs 2. java specifically support ADT 3. It is possible to develop psuedo-recursive code in a non-recursive language(Fortan) 4. (2 and 3)

  • In c# So far, you have created object-oriented code for individual classes. You have built objects...

    In c# So far, you have created object-oriented code for individual classes. You have built objects from these classes. Last week, you created a UML for new inherited classes and objects. Finally, you have used polymorphism. When you add abstraction to this mix, you have the “4 Pillars of OOP.” Now, you begin putting the pieces together to create larger object-oriented programs. Objectives for the project are: Create OO classes that contain inherited and polymorphic members Create abstracted classes and...

  • Hello Sir/Madam, could you please help me for the code to write UNO CARD GAME using...

    Hello Sir/Madam, could you please help me for the code to write UNO CARD GAME using following elements using JAVA Language: 1. Use of at least three Abstract Data Types 2. Use of inheritance and polymorphism 3. Use of recursion 4. Connection and use of a simple database 5. At least one sorting algorithm 6. At least one search algorithm 7. Use of a graphical user interface. Thank you in advance!

  • JAVA - OOP inheritance help please I have a question, I have 4 classes. College, course,...

    JAVA - OOP inheritance help please I have a question, I have 4 classes. College, course, professor, professorInfo College create new course(int x, int y, int z) Professor is a Super class, professorInfo is the sub class of Professor. Each time creating new course, more than 1 professor will be added to some kind of an Array. -------------------------------------------------------------------- I cant figure out how to work around this. I know that I have to create a type of professor which contain...

  • Consider the following Scala code that uses classes, objects, inheritance and dynamic method binding abstract class...

    Consider the following Scala code that uses classes, objects, inheritance and dynamic method binding abstract class A { def m) Int 1 val a Int = 2 class B extends A { val b: String "one" override def m() : Int = 3 def n(): Int 4 class C extends A { val x : Int 5 override def m() : Int = 6 val array an array of ten A objects array (5) val obj: A obj.m() = (a)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT