
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
I need help with a Java
import java.util.Scanner;
import java.io.FileInputStream;
import java.io.IOException;
public class LabProgram {
public static void main(String[] args) throws IOException {
Scanner scnr = new Scanner(System.in);
/* Type your code here. */
}
}

Transcribed Image Text:Write a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program
first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following
requirements:
• Each row contains the title, rating, and all showtimes of a unique movie.
●
A space is placed before and after each vertical separator (1) in each row.
• Column 1 displays the movie titles and is left justified with a minimum of 44 characters.
●
If the movie title has more than 44 characters, output the first 44 characters only.
• Column 2 displays the movie ratings and is right justified with a minimum of 5 characters.
• Column 3 displays all the showtimes of the same movie, separated by a space.
Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive
rows.
Ex: If the input of the program is:
movies.csv
and the contents of movies.csv are:
16:40, Wonders of the World, G
20:00, Wonders of the World, G
19:00, Journey to Space, PG-13
12:45, Buffalo Bill And The Indians or Sitting Bull's History Lesson, PG
15:00, Buffalo Bill And The Indians or Sitting Bull's History Lesson, PG
19:30, Buffalo Bill And The Indians or Sitting Bull's History Lesson, PG
10:00, Adventures of Lewis and Clark, PG-13
14:30, Adventures of Lewis and Clark, PG-13
19:00, Halloween, R
the output of the program is:
Wonders of the World
Journey to Space
|
Buffalo Bill And The Indians or Sitting Bull |
Adventures of Lewis and Clark
|
Halloween
I
G | 16:40 20:00
PG-13 | 19:00
PG | 12:45 15:00 19:30
PG-13 | 10:00 14:30
R
19:00
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- JAVA CODE: check outputarrow_forward1 import java.util.Scanner; 2 3 public class Parsestrings { 4 public static void main(string[] args) { /* Type your code here. */ 5 6 return; 7 8arrow_forwardI have this java code " import java.util.Scanner;public class Main3 {public static void main(String[] args) {// Create Scanner input;Scanner scanner = new Scanner(System.in);boolean Continue = true;while (!Continue) {}// Defining variables with input parametersSystem.out.print("Enter the Loan amount: ");double loanAmount = scanner.nextDouble();System.out.print("Enter the number of years: ");int n = scanner.nextInt();System.out.print("Enter the annual interest rate: ");float a = scanner.nextFloat();// Equations for Variables// Calculate monthly interest ratefloat i = a / 12;// Calculate total monthsint m = n * 12;// Calculate payment monthlyfloat monthlyPayment = (float) ((loanAmount * i * Math.pow(1 + i, n)) / (Math.pow(1 + i, n) - 1));// Calculate Total Paymentfloat totalPayment = monthlyPayment * 12;// Printing the results for VariablesSystem.out.printf("Monthly payment is $%.2f\n", monthlyPayment);System.out.printf("Total payment is $%.2f\n", totalPayment);}}"How do I turn single…arrow_forward
- I want crystal clear answerarrow_forwardI wrote my code in Java and don't know why it doesn't output the statement: import java.util.Scanner; public class LabProgram {public static void main(String[] args) {/* Type your code here. */Scanner scnr = new Scanner(System.in);int num=scnr.nextInt();String word=scnr.nextLine();do {if (word =="quit" && num==0) break;System.out.println("Eating " +num+ " " +word+ " a day keeps you happy and healthy.");System.out.println("Eating " +num+ " " +word+ " a day keeps you happy and healthy.");} while (word != "quit" && num != 0);}} I've attached the screenshots of the full question and error code from the lab.arrow_forwardI need help with a java code problem that needs this output shown in image below: import java.util.Scanner;import java.util.NoSuchElementException; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int val1 = 0, val2 = 0, val3 = 0; // Initialize the variables int max; int inputCounter = 0; // Counter to keep track of the number of inputs read try { String inputLine = scnr.nextLine(); String[] parts = inputLine.split(" "); if (parts.length > 0 && !parts[0].isEmpty()) { val1 = Integer.parseInt(parts[0]); inputCounter++; } if (parts.length > 1 && !parts[1].isEmpty()) { val2 = Integer.parseInt(parts[1]); inputCounter++; } if (parts.length > 2 && !parts[2].isEmpty()) { val3 =…arrow_forward
- import java.util.Scanner; public class RomanNumerals { public static void main(String[] args) { Scanner in = new Scanner("I C X D M L"); char romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 1") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 100") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 10") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 500") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 1000") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 50") ; } /** Gives the value…arrow_forwardIn this java program, please explain the code and the output of the program. Source Code: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String name; String department; double baseSalary; String joinedDate; System.out.print("Enter the Name : "); name = scanner.nextLine(); System.out.print("Enter the Department : "); department = scanner.nextLine(); System.out.print("Enter the Joined Date : "); joinedDate = scanner.nextLine(); System.out.print("Enter the Base Salary : "); baseSalary = scanner.nextDouble(); StaffDeatils staff = new StaffDeatils(name, department, baseSalary, joinedDate); System.out.println(); staff.toString(); }} class StaffDeatils { private String name; private String department; private double baseSalary; private String joinedDate; public StaffDeatils(String name, String department, Double salary, String joinedDate) { this.name = name; this.department =…arrow_forwardimport java.util.Scanner; public class CircleAndSphereWhileLoop{ public static final double MAX_RADIUS = 500.0; public static void main(String[] args) { Scanner in = new Scanner(System.in); // Step 2: Read a double value as radius using prompt // "Enter the radius (between 0.0 and 500.0, exclusive): " // Step 3: While the input radius is not in the ragne (0.0, 500.0) // Display a message on one line (ssuming input value -1) // "The input number -1.00 is out of range." // Read a double value as radius using the same promt double circumference = 2 * Math.PI * radius; double area = Math.PI * radius * radius; double surfaceArea = 4 * Math.PI * Math.pow(radius, 2); double volume = (4 / 3.0) * Math.PI * Math.pow(radius, 3); // Step 4: Display the radius, circle circumference, circle area, // sphere surface area, and…arrow_forward
- 1. What is the output of the following program? import java.util.Scanner; public class Factorial { public static void main(String args[]){ Scanner scanner = new Scanner(System.in); System.out.printIn("Enter the number:"); scanner.nextInt(); int factorial = fact(num); System.out.println("Factorial of int num = entered number is: "+factorial); } static int fact(int n) { int output; if(n==1){ return 1; } output = fact(n-1)* n; return output; } }arrow_forwardStringFun.java import java.util.Scanner; // Needed for the Scanner class 2 3 /** Add a class comment and @tags 4 5 */ 6 7 public class StringFun { /** * @param args not used 8 9 10 11 12 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter your first name: "); 13 14 15 16 17 18 System.out.print("Please enter your last name: "); 19 20 21 //Output the welcome message with name 22 23 24 //Output the length of the name 25 26 27 //Output the username 28 29 30 //Output the initials 31 32 33 //Find and output the first name with switched characters 34 //All Done! } } 35 36 37arrow_forwardI need help with this java problem described below: import java.util.Scanner; import java.util.InputMismatchException; public class ExpirationMonth { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int expirationMonth; boolean valueFound = false; while (!valueFound) { try { expirationMonth = scnr.nextInt(); valueFound = true; System.out.println("Expiration month: " + expirationMonth); System.out.println("Processed one valid input value"); } /* Your code goes here */ } } }arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education