Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please, create a program that contains a JFrame and a Database, using the follow

ID: 3728032 • Letter: P

Question

  



Please, create a program that contains a JFrame and a Database, using the following instructions. Please write it in computer. Project Objectives: To write a program that implements the following Advanced Programming concepts 1. Data encapsulation 2. Instantiate classes 3. Inheritance 4. Graphical User Interface concepts 5. Exception Handling 6. Inner classes 7. Database Project Name: Music Library The program will have the following private attributes: 1. UPC-unique identifier for CD's album (also called ASIN) 2. Album Name -album name 3. Artist artist full name 4. Album Image Name hold the CD image name 5. Genre music genre (salsa, rock, R&B;, etc.) 6. Release Date -release CD's date 7. Rank -CD's rank 8. Format media format (CD, LP, etc.) 9. Price- CD's price The project will display a splash screen then a login frame. If the user name and password are correct then will show the menu program. The program will have the following menu and menu items 1. File Add CD Album Modify CD Album Display CD Album CD Albums Report e ° o Exit 2. Help o Help Contents o About

Explanation / Answer

public class MusicLibriary

{

private long upc,

private String albumname;

private String artistname;

private String imagename;

private String genere;

private String date;

private int rank;

private Double price;

private String format;

}

public class Design extends JFrame implements ActionListener

{

login.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){
//get the username and password from the text filelds

//Get the netred user name and passord
String sLogin = login.getText();
String sPass = pass.getText();

//make a JDBC call to data base and validate the username and password

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // corresponding oracle or sql driver
String url=null,url1=null,

String sql=null;

dbFileName = "C:/db.accdb";

url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};"+
"DBQ="+dbFileName+";"; // url of your respective database
con=DriverManager.getConnection(url);
st=con.createStatement();

  

ResultSet rs=st.executeQuery("select password from LOGIN1 where uname='"+sLogin.trim()+"'");

if(rs.next()){
if(rs.getString(1).equals(sPass)){
//sho the menu

  

JMenuBar menuBar;
JMenu menu, submenu;
JMenuItem menuItem;
JRadioButtonMenuItem rbMenuItem;
JCheckBoxMenuItem cbMenuItem;

//Create the menu bar.
menuBar = new JMenuBar();

//Build the first menu.
menu = new JMenu("A Menu");
menu.setMnemonic(KeyEvent.VK_A);
menu.getAccessibleContext().setAccessibleDescription(
"The only menu in this program that has menu items"); // desciption of items
menuBar.add(menu); // add all the menu itmes that are needed.

}else{
JOptionPane.showMessageDialog(this,"Invalid Password");
}

}
});

}