Question

Movie Structure File Write a program that will read in a CSV file with information regarding...

Movie Structure File Write a program that will read in a CSV file with information regarding movies. The file will contain a movie name, MPAA coding (G, PG, PG-13, R), number of minutes, and ratings (1-10) from the three top critics. Your program will read in the data into an array of structures (No more than 20 movies) and send the array to a function that will produce a professional report file (MovieReport.txt) which includes all of the information, an average rating of the critics for each movie.

Homework Answers

Answer #1

hi. As you not mentioned on which programming language i should write the program. i am writting it in java. Please upvote. it helps me a lot.

1)

MovieClass.java

public class MovieClass {

private String movieName;

private String MPAA_codingNumber;

private String no_Ofminutes;

private String critic1_rating;

private String critic2_rating;

private String critic3_rating;

public String getMovieName() {

return movieName;

}

public void setMovieName(String movieName) {

this.movieName = movieName;

}

public String getMPAA_codingNumber() {

return MPAA_codingNumber;

}

public void setMPAA_codingNumber(String mPAA_codingNumber) {

MPAA_codingNumber = mPAA_codingNumber;

}

public String getNo_Ofminutes() {

return no_Ofminutes;

}

public void setNo_Ofminutes(String no_Ofminutes) {

this.no_Ofminutes = no_Ofminutes;

}

public String getCritic1_rating() {

return critic1_rating;

}

public void setCritic1_rating(String critic1_rating) {

this.critic1_rating = critic1_rating;

}

public String getCritic2_rating() {

return critic2_rating;

}

public void setCritic2_rating(String critic2_rating) {

this.critic2_rating = critic2_rating;

}

public String getCritic3_rating() {

return critic3_rating;

}

public void setCritic3_rating(String critic3_rating) {

this.critic3_rating = critic3_rating;

}

public MovieClass(String movieName, String mPAA_codingNumber,

String no_Ofminutes, String critic1_rating, String critic2_rating,

String critic3_rating) {

super();

this.movieName = movieName;

MPAA_codingNumber = mPAA_codingNumber;

this.no_Ofminutes = no_Ofminutes;

this.critic1_rating = critic1_rating;

this.critic2_rating = critic2_rating;

this.critic3_rating = critic3_rating;

}

@Override

public String toString() {

return "Movie [Name=" + movieName + ", MPAA Number="

+ MPAA_codingNumber + ", No of Minutes=" + no_Ofminutes

+ ", critic1 rating=" + critic1_rating + ", critic2 rating="

+ critic2_rating + ", critic3 rating=" + critic3_rating + "]";

}

}

2) CSVREader.java

import java.io.BufferedReader;

import java.io.FileNotFoundException;

import java.io.FileReader;

import java.io.IOException;

import java.util.ArrayList;

import java.util.List;

public class CSVReader {

public static void DisplayMovies(List<MovieClass> movies){

for(MovieClass m : movies){

System.out.println(m.toString());

}

}

public static void main(String[] args) {

String csvFile = "C:/Users/ADMIN/Desktop/movies.csv";

BufferedReader br = null;

String line = "";

  

List<MovieClass> movieList = new ArrayList<MovieClass>();

try {

br = new BufferedReader(new FileReader(csvFile));

while ((line = br.readLine()) != null) {

// use comma as separator

String[] Movies = line.split(",");

  

MovieClass movieObj = new MovieClass(Movies[0], Movies[1], Movies[2], Movies[3], Movies[4], Movies[5]);

movieList.add(movieObj);

  

}

  

DisplayMovies(movieList);

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

} finally {

if (br != null) {

try {

br.close();

} catch (IOException e) {

e.printStackTrace();

}

}

}

}

}

Output

Movie [Name=A QuitePl, MPAA Number=pg-13, No of Minutes=91 min, critic1 rating= 8 stars, critic2 rating=8 stars, critic3 rating=8 stars]


Movie [Name=Jumanji, MPAA Number=pg-13, No of Minutes=91 min, critic1 rating= 7 stars, critic2 rating=8 stars, critic3 rating=7 stars]


Movie [Name=Get out, MPAA Number=R, No of Minutes=91 min, critic1 rating= 9 stars, critic2 rating=8 stars, critic3 rating=8 stars]

Thank you. please upvote.

Know the answer?
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
Similar Questions
Write a program that will read the information from a file into a list and then...
Write a program that will read the information from a file into a list and then display the list to the screen. Remove the fifth item in the list and display the list again. Ask the program user for an entry into the list and add it to the list. Display the list one last time. disneyin.txt file daisy   123 donald   345 goofy   654 mickey   593 minnie   489 daffy   432 pluto   765 huey   321 dewey   987 lewey   554 porky   333...
You are to write a C++ program to produce an inventory report for a local company....
You are to write a C++ program to produce an inventory report for a local company. Your input will be item name, item number, quantity, price per item, safe stock value. The following shows which columns the input will be in: item name             item number         quantity                  price                      safe stock 20 chars                 5 char                     3 char                      6 chars                 3 chars Output will be as follows: item number         item name    quantity   price     price*quantity   %ofStock    flag You will put a symbol in the...
You are to write a program to produce an inventory report for a local company. Your...
You are to write a program to produce an inventory report for a local company. Your input will be item name, item number, quantity, price per item, safe stock value. The following shows which columns the input will be in: item name item number quantity price safe stock 20 chars 5 char 3 char 6 chars 3 chars Output will be as follows: item number item name quantity   price   price*quantity   %ofStock flag You will put a symbol in the flag...
Read the attached articles about the proposed merger of Xerox and Fujifilm. Utilizing your knowledge of...
Read the attached articles about the proposed merger of Xerox and Fujifilm. Utilizing your knowledge of external and internal analysis, business and corporate strategy, and corporate governance, please discuss the following questions: 1. What is the corporate strategy behind the merger of Xerox and Fujifilm? 2. Why did Xerox agree to the merger? Is this a good deal for Xerox? Discuss the benefits and challenges they face with the merger. 3. Why did Fujifilm agree to the merger? Discuss the...
After reading the following article, how would you summarize it? What conclusions can be made about...
After reading the following article, how would you summarize it? What conclusions can be made about Amazon? Case 12: Amazon.com Inc.: Retailing Giant to High-Tech Player? (Internet Companies) Overview Founded by Jeff Bezos, online giant Amazon.com, Inc. (Amazon), was incorporated in the state of Washington in July 1994, and sold its first book in July 1995. In May 1997, Amazon (AMZN) completed its initial public offering and its common stock was listed on the NASDAQ Global Select Market. Amazon quickly...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...