Java program.
Mike's Movie Theater is a local cinema showing the latest Hollywood hits. Create a class called Movie that stores basic information about a single movie: the title, the running time or length of the film (in minutes), the showtimes (as a single string, such as "11:00,3:15,7:30"), and the film's rating (R, PG-13, PG, or G). Include get and set methods for each; the setter for rating should check that the value is one of the four valid options and, if not, should set the rating to "Not Rated". Be sure to include a constructor that allows values to be set upon instantiation. Finally, a method called addPreviews should accept the number of previews to be shown prior to the movie, and then add 2 minutes for each to the movie's running time.
Demonstrate that your class works in a program called MovieDemo. It does not need to have user input, but make sure you demonstrate that all methods and fields work correctly.
import java.util.Arrays;
class Movie {
private String title;
private int length;
private String showTime;
private String ratings;
public Movie(String title, int length, String showTime, String ratings) {
this.title = title;
this.length = length;
this.showTime = showTime;
setRatings(ratings);
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public String getShowTime() {
return showTime;
}
public void setShowTime(String showTime) {
this.showTime = showTime;
}
public String getRatings() {
return ratings;
}
public void setRatings(String ratings) {
if(Arrays.asList(new String[] {"R", "PG-13", "PG", "G"}).indexOf(ratings) == -1) {
this.ratings = "Not Rated";
} else {
this.ratings = ratings;
}
}
public void addPreviews(int p) {
length += 2*p;
}
@Override
public String toString() {
return "Movie [
title: " + title + "
length: " + length + "
showTime: " + showTime + "
ratings: " + ratings
+ "]
";
}
}
public class MovieDemo {
public static void main(String[] args) {
Movie SpiderMan = new Movie("Spider Man", 90, "1:00", "PG-13");
System.out.println(SpiderMan);
SpiderMan.setRatings("XYZ");
System.out.println(SpiderMan);
SpiderMan.addPreviews(4);
System.out.println(SpiderMan);
}
}

Please upvote, as i have given the exact answer as asked in
question. Still in case of any concerns in code, let me know in
comments. Thanks!
Java program. Mike's Movie Theater is a local cinema showing the latest Hollywood hits. Create a...
Write in Java Movie Theater Ticket App Write a program that allows a user to purchase movie tickets for a showing of one of three movies. Your program will work with two files - a Movie.java and Theater.java file - which will interact with each other. You should begin by creating three Movie objects which will store information about three movies of your choice Once the information has been stored, the program should welcome the user and ask the user...
WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL PASTE AT BOTTOM MOVIES.CPP #include "movies.h" #include "Movie.h" Movies *Movies::createMovies(int max) { //dynamically create a new Movies structure Movies *myMovies = new Movies; myMovies->maxMovies = max; myMovies->numMovies = 0; //dynamically create the array that will hold the movies myMovies->moviesArray = new Movie *[max]; return myMovies; } void Movies::resizeMovieArray() { int max = maxMovies * 2; //increase size by 2 //make an array that is...
Java Project For this assignment, you will write a simulation program to determine the average waiting time at a grocery store checkout while varying the number of customers and the number of checkout lanes. Classes needed: SortedLinked List: Implement a generic sorted singly-linked list which contains all of the elements included in the unsorted linked list developed in class, but modifies it in the following way: delete the addfirst, addlast, and add(index) methods and instead include a single add method...
Write a program in java. You are tasked with writing an application that will keep track of Insurance Policies. Create a Policy class called InsurancePolicies.java that will model an insurance policy for a single person. Use the following guidelines to create the Policy class: • An insurance policy has the following attributes: o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s...
Needs Help with Java programming language For this assignment, you need to write a simulation program to determine the average waiting time at a grocery store checkout while varying the number of customers and the number of checkout lanes. Classes needed: SortedLinked List: Implement a generic sorted singly-linked list which contains all of the elements included in the unsorted linked list developed in class, but modifies it in the following way: • delete the addfirst, addlast, and add(index) methods and...
Java Painter Class This is the class that will contain main. Main will create a new Painter object - and this is the only thing it will do. Most of the work is done in Painter’s constructor. The Painter class should extend JFrame in its constructor. Recall that you will want to set its size and the default close operation. You will also want to create an overall holder JPanel to add the various components to. It is this JPanel that...