Question

Java Program: Make an application called that stores at least four different movies, a showtime (such...

Java Program:

Make an application called that stores at least four different movies, a showtime (such as "11:00am"), and the movie rating (such as "PG-13") in a two-dimensional array. Movies with multiple showtimes should be in the 2d array multiple times, once for each showing. Prompt the user for a movie name and output all showtimes for that film, or a message indicating it was not found.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Java Code:

import java.util.*;
public class Main
{
   public static void main(String[] args) {
       String movies[]={"batman","spiderman","superman","ironman"};
       String ratings[]={"PG-13","UA-12","SN-56","NS-65"};
       String shows[][]={{"11:00 am","02:00 pm"},{"09:00 am","04:30 pm"},{"03:00 am","04:00 pm"},{"06:00 pm","08:00 pm"}};
       Scanner sc=new Scanner(System.in);
       System.out.print("Enter movie name : ");
       String movieName=sc.nextLine();
       int i;
       for(i=0;i<movies.length;i++){
       if(movies[i].toLowerCase().equals(movieName.toLowerCase())){
       System.out.println("Show Times : "+Arrays.toString(shows[i]));

   break;
       }
       }
       if(i==movies.length){
       System.out.println("Movie Not Found");
       }
   }
}

Output:

Add a comment
Know the answer?
Add Answer to:
Java Program: Make an application called that stores at least four different movies, a showtime (such...
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
  • Java program. Mike's Movie Theater is a local cinema showing the latest Hollywood hits. Create a...

    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...

  • Write a java program that stores the following information in a HashMap: Sue is friends with...

    Write a java program that stores the following information in a HashMap: Sue is friends with Bob, Jose, Alex, and Cathy Cathy is friends with Bob and Alex Bob is friends with Alex, Jose, and Jerry After storing the information, prompt the user to enter a name. If the name that is entered is Sue, Cathy, or Bob, print out the name and the list of friends. Otherwise print a message indicating that the name is not in the HashMap.

  • Weather Program Create an application to interacts with a web service in order to obtain data....

    Weather Program Create an application to interacts with a web service in order to obtain data. Program must prompt the user for their city or zip code and request weather forecast data from OpenWeatherMap (https://openweathermap.org). Program must display the weather information in a READABLE format to the user. Requirements: Create a header for your program just as you have in the past. Create a Python Application which asks the user for their zip code or city. Use the zip code...

  • public static double[] getVolumes(double[] base, double[] height, double[] length) Write a Java program called TriangularPrisms which...

    public static double[] getVolumes(double[] base, double[] height, double[] length) Write a Java program called TriangularPrisms which does the following: In the main method: Use a for loop which repeats three times. Within the loop, a. prompt the user to enter the base of the triangular prism and store the value in a double array called base b. prompt the user to enter the corresponding height and store the value in a double array called height c. prompt the user to...

  • In Java. Write a GUI contact list application. The program should allow you to input names...

    In Java. Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...

  • FOR JAVA: Summary: Create a program that stores info on textbooks. The solution should be named...

    FOR JAVA: Summary: Create a program that stores info on textbooks. The solution should be named TextBookSort.java. Include these steps: Create a class titled TextBook that contains fields for the author, title, page count, ISBN, and price. This TextBook class will also provide setter and getter methods for all fields. Save this class in a file titled TextBook.java. Create a class titled TextBookSort with an array that holds 5 instances of the TextBook class, filled without prompting the user for...

  • Please write a Java program that does the following: Create an array of 100 integers. Store...

    Please write a Java program that does the following: Create an array of 100 integers. Store 100 random integers (between 1 and 100) in the array. Print out the elements of the array. Sort the array in ascending order. Print out the sorted array. Prompt the user to enter a number between 1 and 100. Search the array for that number and then display "Found" or "Not Found" message. Display each number from 1 to 100 and the number of...

  • Java Programming Use a one-dimensional array to solve the following program. Write an application that inputs...

    Java Programming Use a one-dimensional array to solve the following program. Write an application that inputs six numbers [Keep the numbers in an array]. The numbers must be between 20 and 200, inclusive. If the number is not between 20 and 200, ask for another input. When a number is entered, display the number only if it is not a duplicate of a number already entered. If it is a duplicate of a number already entered, display a message that...

  • ***Please give the java code for the below and add comments for different areas for a...

    ***Please give the java code for the below and add comments for different areas for a dummy to understand*** This java program will combine the techniques of handling arrays, decision control statements, and loops. Your program should accomplish the following: Build an array that holds characters (size 35) Load the array with random capital letters (use random generator) Your program should present a menu to the user allowing for the following “actions”. To “search” for a target letter of the...

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
ADVERTISEMENT