Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q3. Movie.java and MovieDemo.java. This is a continuation of Exercise 3 from week 6 practical exercises. Import a copy of Movie.java and your main program

image text in transcribed

Q3. Movie.java and MovieDemo.java. This is a continuation of Exercise 3 from week 6 practical exercises. Import a copy of Movie.java and your main program file (MovieDemo.java from week 6) into your week 9 project in Eclipse. Modify your solution code as follows: a. Instead of the movie data being input via the keyboard, read the movie data from the file movieplaylist.csv into an ArrayList of Movie objects by using either the useDelimiter method of the Scanner class or the split method of the String class (these were discussed in the week 8 lecture). About the csv file: Each line of text in the CSV file represents one movie object. Each data item on each line is separated by a comma. Each line of text conforms to the following format: title,company,actor,rating,year,taking where title = movie title company = production company name actor = lead actor name rating = Australian classification rating year = year released takings = gross box-office takings b. You may assume that all of the data in the file is valid, therefore, there is no need to validate any of the data as it is read from the file into the array and ArrayList. c. After reading the data from the file into the ArrayList, ask the user to either enter an actors name, or type q to exit the program. If the user types an actors name, your program should search the array for all movies which contain a partial match for the actors name, displaying a report in the format displayed below. Note in the example below, the user typed Tom, and the report displayed movies for both Tom Hanks and Tom Hardy. d. Your program should calculate the total box office takings for all the movies displayed in the report (as shown in the example output above). e. Ensure that if no matches are found for the actors name, that an empty report is not printed. Instead, inform the user that no movies containing that actor were found. Example output is displayed below: f. Ensure that your report is printed in a neat and tidy fashion with columns aligned. Test the program with different sized files with different sets of data. Make sure your code works correctly if the file isn't found, or if it exists but doesnt have any data in it. Your solution must incorporate appropriate methods utilising appropriate parameter passing

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

import java.io.*; import java.util.*; public class Movie { private String title; private String company; private String actor; private String rating; private int year; private double taking; /** * @param title * @param company * @param actor * @param rating * @param year * @param taking */ public Movie(String title, String company, String actor, String rating, int year, double taking) { this.title = title; this.company = company; this.actor = actor; this.rating = rating; this.year = year; this.taking = taking; } /** * @return the title */ public String getTitle() { return title; } /** * @return the company */ public String getCompany() { return company; } /** * @return the actor */ public String getActor() { return actor; } /** * @return the rating */ public String getRating() { return rating; } /** * @return the year */ public int getYear() { return year; } /** * @return the taking */ public double getTaking() { return taking; } }
Q2. Movie.java and MovieDemo.java. This is a continuation of Exercise 3 from week 6 practical exercises. Import a copy of Movie.java and your main program file (MovieDemo.java from week 6) into your week 9 project in Eclipse. Modify your solution code as follows: a. Instead of the movie data being input via the keyboard, read the movie data from the file movieplaylist.csv into an ArrayList of Movie objects by using either the useDelimiter method of the Scanner class or the split method of the String class (these were discussed in the week 8 lecture). About the csv file: Each line of text in the CSV file represents one movie object. Each data item on each line is separated by a comma. Each line of text conforms to the following format: title,company, actor,rating, year, taking where title = movie title company = production company name actor = lead actor name rating = Australian classification rating year = year released takings = gross box-office takings

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Under what conditions is the return on assets equal to the ROE?

Answered: 1 week ago

Question

=+ If it does this, what happens to the interest rate?

Answered: 1 week ago

Question

=+c. What is the GDP deflator for each of these years?

Answered: 1 week ago