Question: Please I need help Immediately. Write a Java program for below assignment. Thank you so much. Part 1 - Class Specifications Class Studio Store in

Please I need help Immediately. Write a Java program for below assignment. Thank you so much.

Part 1 - Class Specifications

Class Studio

Store in project/package: .bcs345.hwk.movies.business

Member Variables (all private)

Variable

Data Type

Description
Name String

Name of the studio.

Movie Movie[]

Array of Movie.

Member Method Signatures and Descirptions (all public)

Default Constructor

Default constructor. This method should initialize all member variables. The Movie array should be initialized to at least 4 elements.

Hint: Make sure that new is called for ALL reference types. Be very careful with the array.

Get/set methods

Only need get/set methods for name.

void Read(Scanner s)

Read the contents of all member variables from the given instance of Scanner. Assume that the Scanner is already open. See below for the file format. If the member is an array then you read in the number of elements in the array first then read in each element. For example, when reading in the movie array data you should read in the number of elements first and use that number to allocate the array to the appropriate size. After that you will need to read in the values for every element of the array. The format of the input is displayed towards the end of the assignment.

Hint: You can use the Read methods on the other classes to help out.

void Write(PrintStream ps)

Write the contents of all member variables to the given instance of PrintStream. Assume the PrintStream is already open and ready to use. If the member is an array then you should write out the number of elements in the array first then iterate through the array and write out each element. See below for the output file format.

Hint: You can use the Write methods of the other classes to help with this.

void Report(PrintStream ps)

Writes a report of the attraction. See below for a sample. Assume the PrintStream is already open and ready to use. A sample report is given below.

String GetJSON()

This method should return a string using JSON formatting (www.json.org).

Here is the format:

{

variable name : value ,

variable name :

[

{ variable name : value, } ,

{ variable name : value, } ,

]

The [ ] indicate an array. Each element of the array is separated by a comma (no comma after the last element).

If the variable data type is String then the value should be surrounded by double quotes. There should be a comma between each pair (no comma after the last pair).

String toString()

This method should show descriptive text and data. It can be used to display data to the user. For example:

Studio Name: DC

Title: Wonder Woman

Open Date: 5/25/2017

Budget: 150.0

Gross: 797.1

Theater Count: 4165

Title: Man of Steel

Open Date: 6/14/2013

Budget: 225.0

Gross: 667.9

Theater Count: 4207

Title: Suicide Squad

Open Date: 8/5/2016

Budget: 175.0

Gross: 745.6

Theater Count: 4255

Movie GetByIndex(int index)

Returns the Movie instance at the given index.

Should throw an ArrayIndexOutOfBounds exception if the index is invalid. No value will be returned if the index is invalid. Do not print anything in this method.

Movie GetHighestNetMovie()

Searches the array of Movie for the Movie instance that has the highest net and returns it from the method. Do not print anything inside this method.

Class StudioConsoleUI

Store in project/package: .bcs345.hwk.movies.presentation

Member Variables (all private)

Data Type

No member variables

Member Method Signatures and Descriptions (all public)

void ShowUI()

Shows the user interface. When this method is called it should do the following:

Display the menu to the user.

Process the user selections

There should be no display or processing code in main. See the Menu Description section below for details.

Class Main (revise from previous assignment)

Store in project/package: .bcs345.hwk.movies.presentation

Member Variables (all private)

Data Type

No member variables

Member Method Signatures and Descriptions (all public)

public static void main(String args[])

Update the existing main method so that the user is given a choice of which user interface to use.

The choices are MovieConsoleUI (from previous assignment) and StudioConsoleUI.

If the user chooses MovieConsoleUI then create an instance of MovieConsoleUI and call the ShowUI method on it.

If the user chooses StudioConsoleUI then create an instance of StudioConsoleUI and call the ShowUI method on it.

Look in the Menu that Main Shows section below for the menu to display. The menu should keep showing until the user chooses to exit.

Studio UI Menu Description

This program will present a menu to the user and then perform an action depending on what the user chooses to do. You should create an instance of Studio inside of ShowUI. When the program runs it should display the menu to the user and give them a chance to input a choice. An action should be taken depending on what choice the user makes. Here is the user menu:

Studio UI

---------

1 Read studio info from file

2 Write studio info to file

3 Show movie by index

4 Show movie with highest net

5 - Show studio report on screen

6 Show studio as JSON string on screen

7 Show studio toString on screen

8 - Exit

Enter Choice:

THE PROGRAM SHOULD KEEP SHOWING THE MENU AND PERFORMING AN ACTION UNTIL THE USER CHOOSES TO EXIT.

Choice Action
1

Reads in data for the instance of Studio. This menu option expects data to come in according to the Studio file format specified at the end of the assignment. The user should be prompted to enter a filename to read from.

Hint: You can use a function on Studio to help out with this.

2

Writes all data from the Studio instance to a file. The user should be prompted to enter a filename to write the data to. Data should be written out according to the Studio file format specified at the end of this assignment.

Hint: You can use a method on Studio to help out with this.

3

Show movie by index. The user should be prompted to enter an index. All data for the movie at that index should be displayed on the screen. If the index is invalid display a message to the user giving that information.

This menu option should contain a try/catch block for an ArrayIndexOutOfBounds exception. If the user enters an invalid index an ArrayIndexOutOfBounds method should be thrown by GetByIndex and that exception should be caught here.

Hint: You will need to use the GetByIndex method of Studio to code this menu option.

4

Show movie with highest net

Hint: You can use a method on Studio to help out with this.

5

Show the Studio report on the screen. This report should have the same format as the report from assignment 1 (see below for sample report example).

Hint: You can use a method on Studio to help out with this.

6

Show Studio as JSON string.

Hint: You can use a method on Studio to help out with this.

7

Show what Studio toString returns on screen.

Hint: You can use a method on Studio to help out with this.

Menu That Main Shows

Choose UI

---------

1 MovieConsoleUI

2 StudioConsoleUI

3 Exit

Enter Choice:

Studio Report Format

The column widths for each column should be large enough to accommodate the column headers or data (whichever is larger).

Movie Studio Report

-------------------

Studio: DC

Movie Count: 3

Movie Statistics

Title Mth Day Year Theaters Gross (mil) Budget (mil) Net (mil)

----- --- --- ---- -------- ----------- ------------ ---------

Wonder Woman 5 25 2017 4165 797.1 150.0 647.1

Man of Steel 6 14 2013 4207 667.9 225.0 442.9

Suicide Squad 8 5 2016 4255 745.6 175.0 570.6

----- --- --- ---- -------- ----------- ------------ -------

Total 2210.6 550.0 1660.6

File Format (Studio)

Budget (in millions)

Gross (in millions)

Budget (in millions)

Gross (in millions)

Sample Input File (Studio.txt)

DC

3

Wonder Woman

5

25

2017

150.0

797.1

4165

Man of Steel

6

14

2013

225.0

667.9

4207

Suicide Squad

8

5

2016

175.0

745.6

4255

Sample Studio JSON

{

"name" : "DC",

"movie" :

[

{

"title" : "Wonder Woman",

"budget" : 150.0,

"opendate" :

{

"month" : 5,

"day" : 25,

"year" : 2017

},

"boxoffice" :

{

"gross" : 797.1,

"theatercount" : 4165

}

},

{

"title" : "Man of Steel",

"budget" : 225.0,

"opendate" :

{

"month" : 6,

"day" : 14,

"year" : 2013

},

"boxoffice" :

{

"gross" : 667.9,

"theatercount" : 4207

}

},

{

"title" : "Suicide Squad",

"budget" : 175.0,

"opendate" :

{

"month" : 8,

"day" : 5,

" year" : 2016

},

"boxoffice" :

{

"gross" : 745.6,

"theatercount" : 4255

}

}

]

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!