java programming?

Anonymous

Question Description

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

Tutor Answer

DrLicklider
School: Carnegie Mellon University

At...

flag Report DMCA
Review

Anonymous
Tutor went the extra mile to help me with this essay. Citations were a bit shaky but I appreciated how well he handled APA styles and how ok he was to change them even though I didnt specify. Got a B+ which is believable and acceptable.

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors