Stock tracker and debugging | Computer Science homework help
1. Programming assignment.
2. 8 question debugging exercise
4 Using a Database Query Result
Write a Java program to query the StockTracker database for all users and all stocks held by each user. List the user’s ID, first name, and last name followed by their stocks, including both the stock symbol and stock description (name). This can be a console application that produces output to the screen, as shownin Figure 11-80. Use the project, StockTracker, to add additional users and stocks, if necessary. For an extra challenge, use only the StockTrackerDB data access class to obtain data from the database.
Find and fix the error in each line of code. Each line contains only one error.
Indented lines continue the previous statement.
2. String dbn = ” AutoParts”;
3. Connection con = getConnection(dbn);
4. Statement stmt = DriverManager.createStatement();
5. stmt.executeUpdate(“CREATE TABLE StockItemsitemID INT “
6. +”CONSTRAINT PK_Item PRIMARY, “
7. +“CONSTRAINT FK1_Item REFERENCES PartDesc (partno) “
8. +”qtyOnHand INT, price SINGLE, cost SINGLE”);