java programming?

java programming?

13:Constructors

Create a Java class (program) named MovieTicket. See the Section Things to know this week.

It should include the attributes below;


A. String movieTitle                             //Set this to default to null.
B. LocalDateTime movieDateTime      // Set this to default to null.  This requires the line  import java.time.LocalDateTime;
C. int seat . // Set this to default to 0.

Use Eclipse to generate Setters and Getters for these items. - See the Section Things to know this week.
Use Eclipse to generate a toString method for this class - See the Section Things to know this week.

Create a method in this class named isValid() that returns a boolean result. This method should return true only if seat != 0 and movieTitle is not null. Otherwise it must return false.

Create 3 constructors for this class. See Section 11.3 - More Constructors - page 174-175 in the text book.
1. A constructor with no arguments. This code does not need to do anything. However, because the other constructors exist - this needs to be coded.
2. A constructor that would set movieTitle, movieDateTime
3. A constructor that would set movieTitle, movieDateTime, and seat.


***
In the main method, do the following:

You must create a reference for the MovieTicket objects and use the constructors that you created.
The LocalDateTime object can be created and used in all the tasks below:

LocalDateTime myTime = LocalDateTime.now() ;
  1. Create an instance of MovieTicket using constructor 1 and display the instance’s toString() and isValid() result.
  2. Create an instance of MovieTicket using constructor 2 and display the instance’s toString() and isValid() result.
  3. Create an instance of MovieTicket using constructor 3 and display the instance’s toString() and isValid() result.

Sample Output

MovieTicket [movieTitle=null, movieDateTime=null, seat=0] – IsValid = false
MovieTicket [movieTitle=Alita, movieDateTime=2019-04-17T19:10:02.112, seat=0] – IsValid = false
MovieTicket [movieTitle=Alita, movieDateTime=2019-04-17T19:10:02.144, seat=55] – IsValid = true