INVENTORYPROGRAMPART4

INVENTORYPROGRAMPART4 - /* * To change this template,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package inventory.program.part.pkg4; import java.awt.event.*; import javax.swing.*; /** * * @author janaya */ public final class INVENTORYPROGRAMPART4 extends JFrame { private Inventory i; private JTextArea txt; private int view = 0; /** * @param args the command line arguments */ public static void main(String[] args) { INVENTORYPROGRAMPART4 gui = new INVENTORYPROGRAMPART4(); gui.pack(); gui.setVisible(true); } // view DVD public void showDVD() { txt.setText("DVD Details:\n"); txt.append(i.get(view) + "\n"); // total val txt.append(String.format("\nTotal value = $%.2f", i.totalValue())); } public INVENTORYPROGRAMPART4() { super("DVD"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // quit when closed // create 3 products ExtendedDVD p1 = new ExtendedDVD(1, "Tyler Perry's I Can Do Bad All By Myself", 3, 14.99, "24 hours"); ExtendedDVD p2 = new ExtendedDVD(2, "Shottas", 5, 19.99, "22 hours"); ExtendedDVD p3 = new ExtendedDVD(3, "Wanted", 4, 18.99, "18 hours"); // make inventory i = new Inventory(3); i.add(p1, 0); i.add(p2, 1); i.add(p3, 2); // sort i.sort(); // output for (int k = 0; k < 3; k++) { System.out.println(i.get(k)); }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
System.out.println();
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/14/2011 for the course IT 215 taught by Professor Danielreddy during the Spring '11 term at University of Phoenix.

Page1 / 5

INVENTORYPROGRAMPART4 - /* * To change this template,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online