Let me give a brief explanation. In July, I taught a 5-week course through a Java company. They covered basic things like console application, crud operations, mysql and n-tier architecture. Since the course ended, I did not use it much, because I returned to work, and other medical reasons surfaced .... blah blah.
I was told that the company had made a simple program to reflect what I learned. It turns out I saved very little.
I decided to make a program for video games. It will be used to watch your video games so you don’t have to look in your bookcase (or store your games as always.)
To interrupt the chase, I cannot force the user to enter data from one class to another. My AddGame Method In my presentation layer, it is supposed to send user input to the NewGame method at my logical level. The error I am getting is that the column header cannot be null.
Here is my AddGame method
public static Games AddGame() {
Games g = new Games();
Logic aref = new Logic();
Scanner scanline = new Scanner(System.in);
System.out.println("Please enter the title of your game:");
scanline.nextLine();
System.out.println("Please enter the rating of your game:");
scanline.nextLine();
System.out.println("Please enter the platform for your game:");
scanline.nextLine();
System.out.println("Please thenter the developer of your game:");
scanline.nextLine();
aref.NewGame(g);
return g;
}
here is my NewGame method
public static void NewGame(Games g)
{
try {
Class.forName(driver).newInstance();
Connection conn = DriverManager.getConnection(url+dbName,userName,password);
PreparedStatement ps = (PreparedStatement) conn.prepareStatement("INSERT INTO games(Title,Rating,Platform,Developer) " +
"VALUES(?,?,?,?)");
ps.setString(1, g.getTitle());
ps.setString(2, g.getRating());
ps.setString(3, g.getPlatform());
ps.setString(4, g.getDeveloper());
ps.executeUpdate();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
I have not learned how to use sleep mode and I only know how to make a console application. Everything I was looking for was either sleeping or a web application. (sorry if the code seems messy or crappy) Please any advice would be very helpful. Thanks in advance!