Task 14 - Java Database Connectivity with MySQL - Assignment 3, Section B

Assume ‘infosys’ database contains 3 tables i.e. products, product_categories and sales. Column name and data type of each column is shown in below diagram:

You can download the SQL file to create above database, tables and to insert some records for testing purpose.

Make a java class having following static methods (class name shall be your registration number and name):

static void updateSalePrice(int productID, int invoiceID, double newUnitPrice)
static int getTotalSalesBySalemanID(int salemanID)
static ArrayList<String> getProductsNamesByInvoiceID(int invoiceID)

updateSalePrice shall update the unit price in sales table for the records where invoice ID and productID (passed as argument) matches. getTotalSalesBySalemanID shall return the total sales made by the saleman whose ID is passed as argument. getProductsNamesByInvoiceID shall return the list of products’ names that were sold under the invoiceID passed as argument. Definition of main method is given on your course blog website, use exactly same definition, don’t change it.

You would get -10 marks if you cheated or your code matched with some other student.


  1. JAVA is something really difficult and I remember that back when I was doing a course about it I had to quit it because it was just too hard haha. Will try it again in the future.


Post a Comment

Popular posts from this blog

Task 12 - Create Java Program with MySQL Database Connectivity

Java Interfaces and Exception Handling - Practice Problem with Solution

Task 16 - Javafx Program to Create, Retrieve, Update and Delete records with Database