Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java expert please help me the program below. Here is the requirement. For the programming exercises in this assignment you will need Java DB installed

Java expert please help me the program below. Here is the requirement.

For the programming exercises in this assignment you will need Java DB installed on your development system for use as your database management system. If you have installed JDK 7 or higher, you automatically have Jave DB as part of the installation. For each JDBC program in this assignment, create a file called database.properties that hold the configuration information for the jdbc driver and the database url. Your programs should read these properties from the file and use this information when connecting to the database. Your solution must use the java.util.Properties class to load and read the properties. Place the properties file directly under your Java Project folder in Eclipse. Here is an example of the properties you might find in the database.properties file:

jdbc.url=jdbc:derby:Lab11DB;create=true

jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver

image text in transcribed

CONNECT 'jdbc:derby:Lab11DB;create=true';

CREATE TABLE MOVIE (MOVIE_ID int not null primary key GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), MOVIE_NAME varchar(100), RATED varchar(10));

CREATE TABLE MOVIE_REVIEW (REVIEW_ID int not null primary key GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), MOVIE_ID int, REVIEW varchar(500), STARS int); INSERT INTO MOVIE(MOVIE_NAME, RATED) values('Divergent', 'PG-13'); INSERT INTO MOVIE(MOVIE_NAME, RATED) values('Muppets Most Wanted', 'PG'); INSERT INTO MOVIE(MOVIE_NAME, RATED) values('The LEGO Movie', 'PG'); INSERT INTO MOVIE(MOVIE_NAME, RATED) values('Saving Mr. Banks', 'PG-13'); INSERT INTO MOVIE(MOVIE_NAME, RATED) values('Her', 'R');

image text in transcribed

-----MovieDBApp.java------ 
import java.util.Scanner; public class MovieDBApp { private static final int SELECTION_FIND_MOVIE = 1; private static final int SELECTION_WRITE_REVIEW = 2; private static final int SELECTION_VIEW_REVIEWS = 3; private static final int SELECTION_EXIT = 4; public static void main(String[] args) { Scanner in = new Scanner(System.in); int selection = getMenuSelection(in); while(selection != SELECTION_EXIT) { if(selection == SELECTION_FIND_MOVIE) { System.out.print("ENTER RATING>> "); String rating = in.nextLine(); } else if(selection == SELECTION_WRITE_REVIEW) { System.out.print("ENTER MOVIE NAME>> "); String movieName = in.nextLine(); System.out.print("ENTER NUMBER OF STARS (1 - 5)>> "); int stars = in.nextInt(); in.nextLine(); System.out.print("ENTER MOVIE REVIEW TEXT>> "); String reviewText = in.nextLine(); } else if(selection == SELECTION_VIEW_REVIEWS) { System.out.print("ENTER MOVIE NAME>> "); String movieName = in.nextLine(); } else { System.out.println("INVALID MENU OPTION"); } selection = getMenuSelection(in); } in.close(); } public static int getMenuSelection(Scanner in) { int selection = 0; System.out.println(" --- MAIN MENU ---"); System.out.println("(1) Find Movie"); System.out.println("(2) Write Review"); System.out.println("(3) View Movie Reviews"); System.out.println("(4) Exit"); System.out.print(" ENTER MENU SELECTION>> "); if(in.hasNextInt()) { selection = in.nextInt(); in.nextLine(); } else { in.nextLine(); } System.out.println(); return selection; } } 

----Please show your result after you finish the program------

A movie database application that allows a user to look up information about a movie and provide a review for a movie. Your application should provide the following features: List all movies that are rated a particular rating (PG, PG-13, R, etc) entered by the user. All a user to post a review for a particular movie. A review consists of review text and a star rating with o 5 stars Excellent o 4 stars Good o 3 stars Neutral o 2 stars Poor o 1 star Very Poor List all reviews for a movie and include the average star rating for the movie Your solution should read the database connection information (jdbc driver and connection url) from a properties file called database. Properties. You can create a console based application to implement this application or write a GUI interface to provide these movie database features described above. The only requirement is that the class containing the main method should be called MovieDBApp MOVIE MOVIE REVIEW N MOVIE ID INT REVIEW ID MOVIE NAME VARCHAR (100) MOVIE ID INT MOVIE RATING VARCHAR (10) REVIEW VARCHAR (500) STARS INT Here is some information about the database table schema you will be using: A set of commands to create and populate the MOVIE and MOVIE REVIEW tables are provided below A movie database application that allows a user to look up information about a movie and provide a review for a movie. Your application should provide the following features: List all movies that are rated a particular rating (PG, PG-13, R, etc) entered by the user. All a user to post a review for a particular movie. A review consists of review text and a star rating with o 5 stars Excellent o 4 stars Good o 3 stars Neutral o 2 stars Poor o 1 star Very Poor List all reviews for a movie and include the average star rating for the movie Your solution should read the database connection information (jdbc driver and connection url) from a properties file called database. Properties. You can create a console based application to implement this application or write a GUI interface to provide these movie database features described above. The only requirement is that the class containing the main method should be called MovieDBApp MOVIE MOVIE REVIEW N MOVIE ID INT REVIEW ID MOVIE NAME VARCHAR (100) MOVIE ID INT MOVIE RATING VARCHAR (10) REVIEW VARCHAR (500) STARS INT Here is some information about the database table schema you will be using: A set of commands to create and populate the MOVIE and MOVIE REVIEW tables are provided below

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

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

What is Net Working Capital?

Answered: 1 week ago

Question

Explain the Neolithic age compared to the paleolithic age ?

Answered: 1 week ago

Question

What is loss of bone density and strength as ?

Answered: 1 week ago