Question

§ Comment your code - you will be glad you did. You will be reusing code...

§ Comment your code - you will be glad you did. You will be reusing code throughout the semester. § You will demo each of your projects. In each demo, you will be asked to demonstrate the functionality of the program and possibly describe how some of the code works. Be prepared for this. § You will upload your projects on Blackboard. Details about this will be announced in class. § Late projects will lose points: 20% per day of delay. The Blackboard timestamp will show when you uploaded your project. § If you have good reasons that you cannot complete a project on time and you have written documentation, then we can make adjustments to due dates. Good reasons would be illness, family emergency, visiting a conference to present a paper, ... § All the University, Student Life and Fulton School academic integrity policies hold: http://www.asu.edu/studentlife/judicial/integrity.html

2 2. Upload your Projects This is a short guide for the successful upload of a project: § Check the due date of the project on Blackboard § Use Blackboard to upload your project. (Do not send the program as email attachment to the instructor or TA) § Your project should be A CPP FILE and named with the following naming convention: LastName_FirstName.cpp So, my project would be named Gonzalez_Javier.cpp § Include a SCREENSHOT of your project running – showcase the best view

3. Project 2 This project has been designed for you to get experience with transformations (model view, projection, and viewports).

4.1. Overview § You should create a Window, specify 4 viewports (same size) and draw in each viewport a 2D scene as specified below. 4.2 Required Functionality Here are the elements that your program must have. Despite this "list" of requirements, there is a lot of room for creativity!

10 points. Drawing and Double Buffering: You created a program that uses OpenGL and GLUT. The program compiles and runs. A window appears on the screen. You use double buffering. Something moves on the screen. The animation is flicker free.

10 points. Viewports: Divide the Window in 4 viewports. All with the same dimensions.

10 points. Resize: The content of the viewports should remain intact when resizing the Window.

10 Viewport 1: Use squares to represent a planet, the sun, and the moon. Draw the sun at the center of this viewport. Not the center of the Window, but the center of the top-left viewport. Draw a planet rotating around the sun. Draw a moon rotating around the planet. The moon completes a rotation around the planet in 1/24. The planet completes a rotation around the sun in 1/360. 3

10 Viewport 2: Use rectangles to represent a car and two wheels. Draw the car and its wheel in the right side of the viewport. Make the car move right to left and left to right. By itself in an infinite loop. The body of the car moves (translates) and the wheels should rotate in the correct direction. Make the rotation speed of the wheels match the displacement of the car’s body.

10 Viewport 3: Use rectangles to represent two clock hands. When one hand completes a full rotation the other moves 30 degrees.

20 Viewport 4: Put here your project 1. The same shape that you created and it should still be possible to move it with the arrow keys.

10 points. Design / Make a Game / Effort: We will judge the general “design” aspect of the program. This includes various aspects. E.g. programs with additional features, visual design, ... will get some more points and programs with undesirable design choices will get less.

10 points. Organization: following instructions from Section 3. (Naming convention, Word or PDF document, program can execute, screenshots ...)

Homework Answers

Answer #1

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
                   )
               );
           ItmCategory.setActionCommand("cat");
           ItmCategory.addActionListener(JMenuActionListener);
           ItmCategory.setBackground(new Color(255,255,255));

           MnuRec.add(ItmCategory);

           //-- For Stock Adjustment
           JMenuItem ItmStockAdj = new JMenuItem("Stock Adjustment");
           ItmStockAdj.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmStockAdj.setMnemonic('A');
           ItmStockAdj.setIcon(new ImageIcon("images/adjustment.png"));
           ItmStockAdj.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_A,ActionEvent.CTRL_MASK
                   )
               );
           ItmStockAdj.setActionCommand("stockadj");
           ItmStockAdj.addActionListener(JMenuActionListener);
           ItmStockAdj.setBackground(new Color(255,255,255));

           MnuRec.add(ItmStockAdj);
           MnuRec.addSeparator();

           //-- For Invoices
           JMenuItem ItmInv = new JMenuItem("Invoices");
           ItmInv.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmInv.setMnemonic('I');
           ItmInv.setIcon(new ImageIcon("images/invoice.png"));
           ItmInv.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_I,ActionEvent.CTRL_MASK
                   )
               );
           ItmInv.setActionCommand("invoice");
           ItmInv.addActionListener(JMenuActionListener);
           ItmInv.setBackground(new Color(255,255,255));

           MnuRec.add(ItmInv);

           //-- For Purchase Orders
           JMenuItem ItmPO = new JMenuItem("Purchase Orders");
           ItmPO.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmPO.setMnemonic('O');
           ItmPO.setIcon(new ImageIcon("images/purchaseorder.png"));
           ItmPO.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_O,ActionEvent.CTRL_MASK
                   )
               );
           ItmPO.setActionCommand("PO");
           ItmPO.addActionListener(JMenuActionListener);
           ItmPO.setBackground(new Color(255,255,255));

           MnuRec.add(ItmPO);

           //-- For Purchase Receipt
           JMenuItem ItmRecieve = new JMenuItem("Purchase Receipt");
           ItmRecieve.setFont(new Font("Dialog", Font.PLAIN, 12));
           ItmRecieve.setMnemonic('R');
           ItmRecieve.setIcon(new ImageIcon("images/recieve.png"));
           ItmRecieve.setAccelerator(
               KeyStroke.getKeyStroke(
                       KeyEvent.VK_R,ActionEvent.CTRL_MASK
                   )
               );
           ItmRecieve.setActionCommand("preceipt");
           ItmRecieve.addActionListener(JMenuActionListener);
           ItmRecieve.setBackground(new Color(255,255,255));

           MnuRec.add(ItmRecieve);

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

           MnuRec.add(ItmExpense);

           //End records sub menu

       //Setup proccess menu
       JMenu MnuProccess = new JMenu("Proccess");
       MnuProccess.setFont(new Font("Dialog", Font.PLAIN, 12));
       MnuProccess.setMnemonic('P');
       MnuProccess.setBackground(new Color(255,255,255));
       NewJMenuBar.add(MnuProccess);
       //End records menu

           //Set proccess sub menu

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1) You are making a circular turn in your car on a horizontal road when you hit a big patch of ice, causing the force of friction between the tires and the road to become zero. While the car is on the ice, it
1) You are making a circular turn in your car on a horizontal road when you hit a big patch of ice, causing the force of friction between the tires and the road to become zero. While the car is on the ice, itA) moves along a straight-line path away from the center of the circle.B) moves along a straight-line path toward the center of the circle.C) moves along a straight-line path in its original direction.D) continues to follow a...
Data Set Preparation (Using A JMP Folder) Can email you if comment your email. 1. (10...
Data Set Preparation (Using A JMP Folder) Can email you if comment your email. 1. (10 pts.) Using the “Toyota Corolla” data set on Canvas (Home à “JMP” à “(Under: JMP Data Sets folder)”, you will be modeling the “Price” of a car as the dependent variable (Y). Please select one independent variable (X) you think may help explain Price, from the following three: “Age”, “Mileage”, or “Weight” of a car. In the space below, state your choice and explain...
1. Vim commands: a. How do you auto indent your program? b. Explain what the following...
1. Vim commands: a. How do you auto indent your program? b. Explain what the following commands do: dd, y3, p, :set cindent (1 pt) VIM exercises These exercises on the computer need to be repeated by each student in the pair. This is to ensure that both students understand how to get around in Linux!!! For this part of the lab, you will create a .vimrc file that will help you develop your C++ programs using VIM. First, we...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...