Question #37449

Write a program in a class OnDemandMovieHits that computes the cost of each movie sold On Demand. There are 7 movies. You may come up with the list of the 7 movies. Also, come up with a unique cost for each movie per day. The higher the popularity, the more expensive the movie needs to be. Create an array of strings that holds the names of the movies. Create another array that holds the cost of each corresponding movie. Your program should allow the user to select from a menu list of movies and the number of days the customer wants to keep the movie available to them. Locate the movie in the name array and use that index to find the cost per day in the cost array. Compute and print the total cost of sale.

Expert's answer

import java.util.Scanner;
public class OnDemandMovieHits {
    private final String[] MOVIES = {"Harry Poter", "Movie 43", "Big Stan", "Homefront", "Carrie", "Last Vegas", "The Pianist"};
    private final double[] COSTS = {18, 17, 16.5, 13.5, 11, 7, 6};
    private Scanner sc;
    public OnDemandMovieHits() {
    }
    private void start() {
        sc = new Scanner(System.in);
        for (int i = 0; i < 7; i++) {
            System.out.println(i + 1 + ". " + MOVIES[i]);
        }
        System.out.println("Select number of the movie from list: ");
        int num = sc.nextInt();
        System.out.println("Enter number of days: ");
        int day = sc.nextInt();
        System.out.println("Total sost fo sale = " + COSTS[num] * day);
    }
    public static void main(String args[]) {
        OnDemandMovieHits odmh = new OnDemandMovieHits();
        odmh.start();
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS