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

Frequent buyers are complaining about the poor organization of the e commerce co

ID: 3790975 • Letter: F

Question

Frequent buyers are complaining about the poor organization of the e commerce company in packing and delivering of the different orders. As a outcome of it, senior management decided to hire a database expert and in that process they selected you to design a sample database to check your capability. Some constraints are given based on which you have to design a specific part of the database for the e commerce company. A customer has a name and is located in an area identified by the AreaCode. Using the AreaCode, you can determine the AreaName. An order is identified by an OrderNo. Order consists of several items. A customer can places more than one order at a time. Each item ordered is identified by ItemNo which has a description and a quantity. A company can take multiple orders and have multiple customers. A company is identified by a RegID, name, address, and phone number. Design an ER diagram describing the database discussed above. Also, specify the cardinality and participation constraints in the relationships. Write your assumptions if any. Transform this ER diagram into relational schema. Describe the relation - attributes and the constraints on the relations thus obtained.

Explanation / Answer

import javax.swing.*;
import javax.swing.plaf.metal.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.beans.*;
import java.sql.*;


/*
import com.incors.plaf.*;
import com.incors.plaf.kunststoff.*;
import com.incors.plaf.kunststoff.themes.*;
*/

public class MainForm extends JFrame implements WindowListener{

   /************************ Variable declaration start **********************/

   //The form container variable
   JPanel Panel1;
   JDesktopPane Desk1 = new JDesktopPane();


   JLabel StatusLabel = new JLabel("Copyright © 2004 by Philip V. Naparan. All Rights Reserved. Visit http://www.naparansoft.cjb.net.",JLabel.CENTER);
   JLabel BusinessTitleLabel = new JLabel();

   Dimension screen =    Toolkit.getDefaultToolkit().getScreenSize();

   String StrBusinesTitle;
   String DBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
   String DBSource = "jdbc:odbc:NaparansoftInventory";
String DBUserName = "Admin";
   String DBPassword = "philip121";

   Connection CN;

   //--Start variable the contains forms
   FrmCustomer FormCustomer;
   FrmSupplier FormSupplier;
   FrmSalesRep FormSalesRep;
   FrmWarehouse FormWarehouse;
   FrmProduct FormProduct;

   FrmInvoice FormInvoice;


   FrmSplash FormSplash = new FrmSplash();
   //--End variable the contains forms

   Thread ThFormSplash = new Thread(FormSplash);
   //End the form container variable

   /********************** End variable declaration start ********************/

   /************************ MainForm constructor start **********************/

   public MainForm(){
       //Set the main form title
       super("Naparansoft Inventory System version 1.1");
       //End set the main form title

       loadSplashScreen();
       //We will dispose now the FormSplash because it is now useless
       FormSplash.dispose();

       //StatusLabel.setBorder(BorderFactory.createTitledBorder(""));
       StatusLabel.setFont(new Font("Dialog", Font.PLAIN, 12));

       StrBusinesTitle = "Your Business Name";

       BusinessTitleLabel.setText(StrBusinesTitle);
       BusinessTitleLabel.setHorizontalAlignment(JLabel.LEFT);
       BusinessTitleLabel.setForeground(new Color(166,0,0));

       //Set the main form properties
       addWindowListener(this);

       Desk1.setBackground(Color.gray);
       Desk1.setBorder(BorderFactory.createEmptyBorder());
       //Most fastest drag mode
       Desk1.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

Panel1 = new JPanel(new BorderLayout());
Panel1.setBackground(Color.gray);
       Panel1.setBorder(BorderFactory.createLoweredBevelBorder());
Panel1.add(new JScrollPane(Desk1),BorderLayout.CENTER);

       getContentPane().add(CreateJToolBar(),BorderLayout.PAGE_START);
       getContentPane().add(Panel1,BorderLayout.CENTER);
       getContentPane().add(StatusLabel,BorderLayout.PAGE_END);

       setJMenuBar(CreateJMenuBar());
       setExtendedState(this.MAXIMIZED_BOTH);

       setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
       setIconImage(new ImageIcon("images/appicon.png").getImage());
       setLocation(0,0);
       setSize(screen);
       setResizable(true);

       setVisible(true);
       show();

       try{
           Class.forName(DBDriver);
           CN = DriverManager.getConnection(DBSource,DBUserName ,DBPassword);
       }catch(ClassNotFoundException e) {
            System.err.println("Failed to load driver");
            e.printStackTrace();
            System.exit(1);
        }
        catch(SQLException e){
            System.err.println("Unable to connect");
            e.printStackTrace();
            System.exit(1);
        }
       //End set the main form properties
   }

   /********************** End MainForm constructor start ********************/

   /*********************** Custom class creation start **********************/

   //Create menu bar
   protected JMenuBar CreateJMenuBar(){
       JMenuBar NewJMenuBar = new JMenuBar();

       //Setup file menu
       JMenu MnuFile = new JMenu("File");
       MnuFile.setFont(new Font("Dialog", Font.PLAIN, 12));
       MnuFile.setMnemonic('F');
       MnuFile.setBackground(new Color(255,255,255));
       NewJMenuBar.add(MnuFile);
       //End setup file menu

           //Set file sub menu
           JMenuItem ItmLockApp = new JMenuItem("lock Application");
           ItmLockApp.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmLockApp.setMnemonic('L');
           ItmLockApp.setIcon(new ImageIcon("images/lockapplication.png"));
           ItmLockApp.setAccelerator(
                   KeyStroke.getKeyStroke(
                       KeyEvent.VK_L,ActionEvent.CTRL_MASK
                       )
               );
           ItmLockApp.setActionCommand("lockapp");
           ItmLockApp.addActionListener(JMenuActionListener);
           ItmLockApp.setBackground(new Color(255,255,255));

           JMenuItem ItmLoggOff = new JMenuItem("Logg Off");
           ItmLoggOff.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmLoggOff.setMnemonic('O');
           ItmLoggOff.setIcon(new ImageIcon("images/loggoff.png"));
           ItmLoggOff.setAccelerator(
                   KeyStroke.getKeyStroke(
                       KeyEvent.VK_O,ActionEvent.CTRL_MASK
                       )
               );
           ItmLoggOff.setActionCommand("loggoff");
           ItmLoggOff.addActionListener(JMenuActionListener);
           ItmLoggOff.setBackground(new Color(255,255,255));

           JMenuItem ItmExit = new JMenuItem("Exit");
           ItmExit.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmExit.setMnemonic('E');
           ItmExit.setIcon(new ImageIcon("images/exit.png"));
           ItmExit.setAccelerator(
                   KeyStroke.getKeyStroke(
                       KeyEvent.VK_E,ActionEvent.CTRL_MASK
                       )
               );
           ItmExit.setActionCommand("exit");
           ItmExit.addActionListener(JMenuActionListener);
           ItmExit.setBackground(new Color(255,255,255));

           MnuFile.add(ItmLockApp);
           MnuFile.addSeparator();
           MnuFile.add(ItmLoggOff);
           MnuFile.add(ItmExit);
           //End set file sub menu

       //Setup records menu
       JMenu MnuRec = new JMenu("Records");
       MnuRec.setFont(new Font("Dialog", Font.PLAIN, 12));
       MnuRec.setMnemonic('R');
       MnuRec.setBackground(new Color(255,255,255));
       NewJMenuBar.add(MnuRec);
       //End records menu

           //Set records sub menu

           //-- For Customer
           JMenuItem ItmCustomer = new JMenuItem("Customers");
           ItmCustomer.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmCustomer.setMnemonic('C');
           ItmCustomer.setIcon(new ImageIcon("images/customer.png"));
           ItmCustomer.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_C,ActionEvent.CTRL_MASK
                   )
               );
           ItmCustomer.setActionCommand("cus");
           ItmCustomer.addActionListener(JMenuActionListener);
           ItmCustomer.setBackground(new Color(255,255,255));

           MnuRec.add(ItmCustomer);

           //-- For Supplier
           JMenuItem ItmSupplier = new JMenuItem("Suppliers");
           ItmSupplier.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmSupplier.setMnemonic('S');
           ItmSupplier.setIcon(new ImageIcon("images/supplier.png"));
           ItmSupplier.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_S,ActionEvent.CTRL_MASK
                   )
               );
           ItmSupplier.setActionCommand("sup");
           ItmSupplier.addActionListener(JMenuActionListener);
           ItmSupplier.setBackground(new Color(255,255,255));

           MnuRec.add(ItmSupplier);

           //-- For SalesRep
           JMenuItem ItmSalesRep = new JMenuItem("SalesRep");
           ItmSalesRep.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmSalesRep.setMnemonic('R');
           ItmSalesRep.setIcon(new ImageIcon("images/SalesRep.png"));
           ItmSalesRep.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_B,ActionEvent.CTRL_MASK
                   )
               );
           ItmSalesRep.setActionCommand("bran");
           ItmSalesRep.addActionListener(JMenuActionListener);
           ItmSalesRep.setBackground(new Color(255,255,255));

           MnuRec.add(ItmSalesRep);

           //-- For Warehouse
           JMenuItem ItmWarehouse = new JMenuItem("Warehouse");
           ItmWarehouse.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmWarehouse.setMnemonic('W');
           ItmWarehouse.setIcon(new ImageIcon("images/Warehouse.png"));
           ItmWarehouse.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_B,ActionEvent.CTRL_MASK
                   )
               );
           ItmWarehouse.setActionCommand("wareh");
           ItmWarehouse.addActionListener(JMenuActionListener);
           ItmWarehouse.setBackground(new Color(255,255,255));

           MnuRec.add(ItmWarehouse);
           MnuRec.addSeparator();

           //-- For Products
           JMenuItem ItmProduct = new JMenuItem("Products");
           ItmProduct.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmProduct.setMnemonic('P');
           ItmProduct.setIcon(new ImageIcon("images/product.png"));
           ItmProduct.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_P,ActionEvent.CTRL_MASK
                   )
               );
           ItmProduct.setActionCommand("prod");
           ItmProduct.addActionListener(JMenuActionListener);
           ItmProduct.setBackground(new Color(255,255,255));

           MnuRec.add(ItmProduct);

           //-- For Categories
           JMenuItem ItmCategory = new JMenuItem("Categories");
           ItmCategory.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmCategory.setMnemonic('T');
           ItmCategory.setIcon(new ImageIcon("images/categories.png"));
           ItmCategory.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_T,ActionEvent.CTRL_MASK
                   )
               );

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote