Question: I have to create a java program that connects to MySQL db. The program is for an online store that has the following capabilities. a.
I have to create a java program that connects to MySQL db. The program is for an online store that has the following capabilities.
a. The application will allow to use any of the franchisees grocery stores for pickup.
b. The application will allow to search for a product online.
c. The application will allow the customer to read product description.
d. The application will allow to make an online payment.
e. The application will allow the system admin to add new products.
f. The application will allow the system admin to change product prices.
g. The application will allow the system admin to load product pictures.
Here are the tables created in MySQL
CREATE TABLE Customer (CustomerID INT AUTO_INCREMENT PRIMARY KEY, FirstName VARCHAR(50) NOT NULL, LastName VARCHAR(50) NOT NULL, Email VARCHAR(100) UNIQUE NOT NULL, Phone VARCHAR(20) NOT NULL, Address VARCHAR(200) NOT NULL);
CREATE TABLE Inventory ( ItemID INT AUTO_INCREMENT PRIMARY KEY, ItemName VARCHAR(100) NOT NULL, ItemDescription TEXT, ItemPrice DECIMAL(10,2) NOT NULL, ItemQuantity INT NOT NULL);
CREATE TABLE Payment (PaymentID INT AUTO_INCREMENT PRIMARY KEY, PaymentDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PaymentAmount DECIMAL(10,2) NOT NULL, CustomerID INT NOT NULL, FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID));
CREATE TABLE `order`(OrderID INT AUTO_INCREMENT PRIMARY KEY, OrderDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, OrderStatus VARCHAR(20) NOT NULL, CustomerID INT NOT NULL, FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID));
CREATE TABLE OrderDetails (OrderDetailID INT AUTO_INCREMENT PRIMARY KEY, ItemID INT NOT NULL, Quantity INT NOT NULL, Price DECIMAL(10,2) NOT NULL, OrderID INT NOT NULL, FOREIGN KEY (ItemID) REFERENCES Inventory(ItemID), FOREIGN KEY (OrderID) REFERENCES `order`(OrderID));
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
