Question

Lab Exercise 5.2 Instructions: Name the program toMoviesYourLastNameFirstInitialLE52.java. The ...

Lab Exercise 5.2 Instructions: Name the program toMoviesYourLastNameFirstInitialLE52.java.

  1. The only class variable will be for the Scanner class.

  2. setMovieTitle(): Prompts for the title of the movie, and returns it from the keyboard.

  3. setYearReleased(): Prompts for the year in which the movie was released, and

    returns it from the keyboard.

  4. setMovieGenre(): Prompts for the type or category of the movie: action, animation,

    comedy, crime, documentary, drama, and returns it from the keyboard.

  5. setTicketPrice(): Prompts for the price of a movie ticket, and returns it from the

    keyboard.

  6. setProductionBudget(): Prompts for the movie’s production budget, and returns it

    from the keyboard.

  7. calcTicketSales(): Receives the production budget and the ticket price, and returns

    the number of tickets to be sold to break-even.

  8. displayMovieInfo(): Receives the ticket price, movie title, year released, movie

    genre, production budget, and the number of tickets to be sold to break-even.

  9. Consider clearing the buffer one time, and only in the main().

  10. In the main(): Call the methods in the order listed.

    1. setMovieTitle() and stores the returned value in a local variable. Example:

      localVar = methodName();

    2. setYearReleased() and stores the returned value in a local variable.

    3. setMovieGenre() and stores the returned value in a local variable.

    4. setTicketPrice() and stores the returned value in a local variable.

    5. setProductionBudget() and stores the returned value in a local variable.

    6. displayMovieInfo() by sending it as arguments the local variables for the ticket

      price, movie title, year released, movie genre, movie budget, and a call to calcTicketSales(). Example: methodName1(arg1, arg2, arg3, arg4, arg5, methodName2(arg7, arg8));

      Sample Output:

      Enter the movie title: How to Train Your Dragon: The Hidden World Enter the movie's release year: 2019
      Enter the movie's genre: Animation
      Enter the price of a movie ticket: 9

      Enter the movie's production budget without the trailing zeroes, e.g. $5,000,000 is entered as 5: 129

      MOVIE BREAK-EVEN POINT IN TICKETS ****Basis: $9.00 per Ticket****

      //This prompt is separated into //2 lines.

      Movie: How to Train Your Dragon: The Hidden World Year Released: 2019
      Genre: Animation
      Production Budget: $129.0 million

      Break-Even Ticket Sales: 14,333,333

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

import java.text.NumberFormat;
import java.util.Scanner;

public class MoviesReview {
  
private static Scanner sc;
  
public static void main(String[] args)
{
// input and set movie title
String movieTitle = setMovieTitle();
  
// input and set movie release year
String yearReleased = setYearReleased();
  
// input and set movie genre
String movieGenre = setMovieGenre();
  
// input and set movie ticket price
double ticketPrice = setTicketPrice();
  
// input and set movie production budget
double productionBudget = setProductionBudet();
  
// display movie details
displayMovieInfo(movieTitle, yearReleased, movieGenre, ticketPrice
, productionBudget, calcTicketSales(productionBudget, ticketPrice));
}
  
public static String setMovieTitle()
{
System.out.print("Enter the movie title: ");
sc = new Scanner(System.in);
return sc.nextLine();
}
  
public static String setYearReleased()
{
System.out.print("Enter the movie's release year: ");
sc = new Scanner(System.in);
return sc.nextLine();
}
  
public static String setMovieGenre()
{
System.out.print("Enter the movie's genre: ");
sc = new Scanner(System.in);
return sc.nextLine();
}
  
public static double setTicketPrice()
{
System.out.print("Enter the price of a movie ticket: ");
sc = new Scanner(System.in);
return sc.nextDouble();
}
  
public static double setProductionBudet()
{
System.out.print("Enter the movie's production budget withourt the trailin zeros, e.g. $5,000,000 is entered as 5: ");
sc = new Scanner(System.in);
return sc.nextDouble();
}
  
public static int calcTicketSales(double productionBudget, double ticketPrice)
{
return (int)((productionBudget * 1000000) / ticketPrice);
}
  
public static void displayMovieInfo(String title, String releaseYear, String genre
, double ticketPrice, double productionBudget, int breakEvenTicketSales)
{
// format break-even ticket sales value separated by commas
//with a group of 3 from the right
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setGroupingUsed(true);
  
System.out.println("\n\nMOVIE BREAK-EVEN POINTS IN TICKETS\n"
+ "***** Basis: $" + String.format("%.2f", ticketPrice) + " per Ticket *****\n");
System.out.println("Movie: " + title
+ "\nYear Released: " + releaseYear
+ "\nGenre: " + genre
+ "\nProduction Budget: " + String.format("%.1f", productionBudget) + " million"
+ "\nBreak-Even Ticket Sales: " + numberFormat.format(breakEvenTicketSales));
}
}

******************************************************** SCREENSHOT *******************************************************************Output RockPaperScissors (run) Enter the movie title: How to train your dragon Enter the movies release year: 2019 Enter the

Add a comment
Know the answer?
Add Answer to:
Lab Exercise 5.2 Instructions: Name the program toMoviesYourLastNameFirstInitialLE52.java. The ...
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
  • Purpose: To learn how to create and use stand-alone class programs (classes withouta main method)...

    LE 7.2 Purpose: To learn how to create and use stand-alone class programs (classes withouta main method). When you take code out of the application class and put it in a class of its own, you make it reusable Prep Work: Chapter 7 Figure 7.6 shows you how an application class uses the services of a Java class in Figure 7.5. Although the code for LE 7.2 is different than the code in these figures, the concept is the same....

  • WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL...

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

  • Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU...

    Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU START: // This homework is built on homework 06. The given program is an updated version of hw06 solution. It begins by displaying a menu to the user // with the add() function from the last homework, as well as some new options: add an actor/actress to a movie, display a list of movies for // an actor/actress, delete all movies, display all movies,...

  • JAVA Code Requried Copy the file java included below. This program will compile, but, when you...

    JAVA Code Requried Copy the file java included below. This program will compile, but, when you run it, it doesn’t appear to do anything except wait. That is because it is waiting for user input, but the user doesn’t have the menu to choose from yet. We will need to create this. Below the main method, but in the Geometry class, create a static method called printMenu that has no parameter list and does not return a value. It will...

  • Using an object-oriented approach, write a program to read a file containing movie data (Tile, Director,...

    Using an object-oriented approach, write a program to read a file containing movie data (Tile, Director, Genre, Year Released, Running Time) into a vector of structures and perform the following operations: Search for a specific title Search for movies by a specific director Search for movies by a specific genre Search for movies released in a certain time period Search for movies within a range for running time Display the movies on the screen in a nice, easy to read...

  • Exercise 6-3 Reconciliation of Absorption and Variable Costing Net Operating Incomes Special instructions: Complete Exercise 6-3...

    Exercise 6-3 Reconciliation of Absorption and Variable Costing Net Operating Incomes Special instructions: Complete Exercise 6-3 in this document after the requirements list. You can create a table for the reconciliation report. Exhibit 6-4 provides an example that should help you complete the exercise. Jorgansen Lighting, Inc., manufactures heavy-duty street lighting systems for municipalities. The company uses variable costing for internal management reports and absorption costing for external reports to shareholders, creditors, and the government. The company has provided the...

  • Assume your grandparents have a Conservation Reserve Program (CRP) contract for 100 acres which w...

    Assume your grandparents have a Conservation Reserve Program (CRP) contract for 100 acres which will expire next year. They can renew the contract for another 10 years and receive a payment of $85/acre each year, but they are wondering if it would be more profitable to put the 100 acres into hay production and have it custom farmed. Since you are taking college classes, they want you to determine the optimal decision. Your grandparents gave you the following information to...

  • For this lab you will write a Java program that plays the dice game High-Low. In...

    For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------ ------ High 1 x Wager Low 1 x Wager Sevens 4 x...

  • Java Program Note: no break statements or switch staements High, Low, Sevens For this lab you...

    Java Program Note: no break statements or switch staements High, Low, Sevens For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------...

  • Instructions Amount Descriptions Questions (Part A) Production Budget Instructions Genuine Spice Inc. began operations on January...

    Instructions Amount Descriptions Questions (Part A) Production Budget Instructions Genuine Spice Inc. began operations on January 1 of the current year. The company produces eight-ounce bottles of hand and body lotion called Eternal Beauty. The lotion is sold wholesale in 12-bottle cases for $100 percase. There is a soling commission of $20 per case. The January direct materials, direct labor, and factory overhead costs are as follows: DIRECT MATERIALS Cost Behavior Units per Case Cost per Unit Cost per Case...

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