Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
This is what I have so far. The database can just be made up. package edi.
I need help on this badly! This is what I have so far. As much help as you can give will be greatly appreciated, please just let me know how far you got. The database can just be made up.
package edi.iupui.cit214;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class JDBCBasic {
private static final String SELECT_FROM_CUSTOMER = "select * from
customer";
public static void main(String[] args) throws SQLException {
Connection connection = null;
try {
loadDriver();
connection = getConnection();
//selectFromCustomerTable(connection);
insertToCustomerTable(connection);
} finally {
connection.close();
}
}
private static void selectFromCustomerTable(Connection connection)
throws SQLException {
PreparedStatement prepareStatement =
connection.prepareStatement(SELECT_FROM_CUSTOMER);
ResultSet resultSet = prepareStatement.executeQuery();
System.out.println("================================================
========================");
System.out.println("CUSTOMER");
System.out.println("================================================
========================");
while (resultSet.next()) {
// , CUSTOMER_NAME, STREET, CITY, STATE, ZIP,
BALANCE, CREDIT_LIMIT, REP_NUM
String data =
resultSet.getString("CUSTOMER_NUM") + ", " +
resultSet.getString("CUSTOMER_NAME");
System.out.println(data);
}
System.out.println("================================================
========================");
}
private static void insertToCustomerTable(Connection connection)
throws SQLException {
PreparedStatement prepareStatement =
connection.prepareStatement(" INSERT INTO CUSTOMER " +
" VALUES " +
" ('104','Cool Sports','2837
Greenway','Fillmore','FL','33336',6550.00,7500.00,'20') ");
int result = prepareStatement.executeUpdate();
if (result == 1) {
System.out.println("Successfully inserted.");
}
else {
System.out.println("Failed to insert.");
}
}
private static Connection getConnection() {
Connection connection = null;
try {
connection = DriverManager
.getConnection("jdbc:mysql://localhost/premiere?" +
"user=root&password=mysql214");
System.out.println("Database connection
acquired");
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " +
ex.getMessage());
System.out.println("SQLState: " +
ex.getSQLState());
System.out.println("VendorError: " +
ex.getErrorCode());
}
return connection;
}
private static void loadDriver() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
System.out.println("Driver Loaded");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Instructions!!
The movie catalog viewing and rating component allows any user (no login necessary) to perform the following:
1. Search and view for movies. Searching capabilities could be limit to the title of the movie.
2. Add rating to a movie. This includes rating scale 1 to 10 and a comment section.
3. (This could be another bonus functionality) Ability to select existing comment and like it. The system should display the number for likes a comment has received.
How to Calculate the Rating
Rating calculation can be as simple as average of all the rates given movie has received.
Implementation Details
Command line Menu:
Main Menu:
1) Admin
2) User
3) Exit
User could select an option from this list. If user select 1, it should display Admin Menu with the following options:
Admin Menu:
1) Add new movie
2) Search and update movie
3) Search and delete
Implements these options for admin personnel.
In main menu, if user select 2 from the Main Menu it should display user menu. User menu should contains the following options:
User Menu:
1) Search movie
2) Rate movie
3) Add comments
Implement these options for user activities.
Note
: Make sure you implement the project by following object oriented design paradigm
The movie catalog viewing and rating component allows any user (no login necessary) to perform the following:
1. Search and view for movies. Searching capabilities could be limit to the title of the movie.
2. Add rating to a movie. This includes rating scale 1 to 10 and a comment section.
3. (This could be another bonus functionality) Ability to select existing comment and like it. The system should display the number for likes a comment has received.
How to Calculate the Rating
Rating calculation can be as simple as average of all the rates given movie has received.
Implementation Details
Command line Menu:
Main Menu:
1) Admin
2) User
3) Exit
User could select an option from this list. If user select 1, it should display Admin Menu with the following options:
Admin Menu:
1) Add new movie
2) Search and update movie
3) Search and delete
Implements these options for admin personnel.
In main menu, if user select 2 from the Main Menu it should display user menu. User menu should contains the following options:
User Menu:
1) Search movie
2) Rate movie
3) Add comments
Implement these options for user activities.