INVENTORYPROGRAMPART5

INVENTORYPROGRAMPART5 - /* * 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.pkg5; import javax.swing.*; import java.awt.event.*; import java.util.*; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JPanel; /** * * @author janaya */ public class INVENTORYPROGRAMPART5 { /** * @param args the command line arguments */ public static void main(String[] args) { // Application_DVD gui = new Application_DVD(); gui.pack(); gui.setVisible(true); } // } //Stores and then gets info on a DVD final class Application_DVD extends JFrame { private JTextArea txt; private Inventory inv; private int currentDisplay = 0; public Application_DVD() { super("DVD Program"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // quit if the window is closed init(); } public void init() { //make 3 objects 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 an inventory and put in the objects inv = new Inventory(); inv.add(p1); inv.add(p2);
Background image of page 1

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

View Full DocumentRight Arrow Icon
inv.add(p3); inv.sort(); // output the info for (int i = 0; i < inv.size(); i++) { System.out.println("Item number: " + inv.get(i).getItem()); System.out.println("DVD name: " + inv.get(i).getName()); System.out.println("Units in stock: " + inv.get(i).getUnits());
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.

Page1 / 6

INVENTORYPROGRAMPART5 - /* * 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