2 Replies - 658 Views - Last Post: 28 February 2009 - 06:08 PM Rate Topic: -----

#1 Arkind  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 13-February 09

Fixing Code Errors

Posted 28 February 2009 - 06:03 PM

I did some something to this LONG code. I got a few errors like 5.

 
import java.awt.*;  // import the java awt package
import java.awt.event.*;  // Import the java event package
import javax.swing.*; // Import the java swing package
import java.util.*; // Import the java utility package
import java.io.*; // Import the java input output package
import java.lang.*; // Import the java lang package
import java.text.*; // Import the java text package
import java.math.*;  // Import the java math package

// starts the program sets up the intial inventory
public class DvdInvApp {



	// main method begins execution of java application
	public static void main(String[] args) {

	FeeQtyProduct product = null;
	DvdInv inventory = new DvdInv();

	product = new FeeQtyProduct( "Matrix",1, 12, 12.95, "First one" );
	inventory.addFeeQtyProduct(product );

	product = new FeeQtyProduct( "Matrix", 2, 8,  8.95, "Reloaded" );
	inventory.addFeeQtyProduct(product );

	product  = new FeeQtyProduct( "Matrix", 3, 4,  10.95, "Revolutions");
	inventory.addFeeQtyProduct(product );

	product  = new FeeQtyProduct( "StarWars", 4, 7, 11.95, "Episode 1" );
	inventory.addFeeQtyProduct(product );

	new DvdInvGUI(inventory); // open GUI

	} // end main

} // end DvdInvApp


abstract class Product
{
	public String productName; //name
	public int productNumber; // product number
	private double baseAmount; // quantity in Inv
	private double basePrice; // inital price

	 // four-argument constructor
 	public Product( String name, int number, double amount, double price  )
	{
		productName = name;
 		productNumber = number;
		baseAmount = amount;
		basePrice = price;

	} // end four-argument Product constructor

	 // set Product Name
	public void setProductName( String name )
	{
		productName = name;

	} // end method setProductName

	 // return ProductName
	public String getProductName()
 	{
		return productName;

	} // end method getProductName


	 // set ProductNumber
	public void setProductNumber( int number )
	{
		productNumber = number; // should validate

	} // end method setProductNumber


	 // return ProductNumber
	 public int getProductNumber()
 	{
		 return productNumber;

	} // end method getProductNumber

	// set initial price
	 public void setBaseAmount( double amount )
	{
		baseAmount = amount;

	} // end method setBaseAmount

	 // return BaseAmount
	public double getBaseAmount()
	{
		return baseAmount;

	} // end method getBaseAmount

	// set BasePrice
	 public void setBasePrice( double price )
	 {
		basePrice = price; // non-negative

	 } // end method setBasePrice

	 // return BasePrice
	 public double getBasePrice()
	{
		return basePrice;

	} // end method getBasePrice

	// return String representation of Product object no longer needed
	public String toString()
	{
		return String.format( "%s\nProduct#: %f\nQTY#:%.0f\nPrice: $%.2f ",
 		getProductName(), getProductNumber(), getBaseAmount(), getBasePrice() );

 	} // end method toString

	// abstract method overridden by subclasses

		public abstract double total(); // no implementation here
		public abstract double restock(); // no implementation here

} // end abstract class Product

class FeeQtyProduct  extends Product
{

	private String DvdTitle; // Dvd title

	// five-argument constructor
 	public FeeQtyProduct( String name, int number, double amount, double price, String title )
	 {
		super( name, number, amount, price );
		setDvdTitle( title);

	} // end five-argument FeeQtyProduct  constructor


	// set DvdTitle
	 public void setDvdTitle( String title )
	 {
		dvdTitle = title;

	 } // end method setDvdTitle

	 // return dvdTitle
	 public String getdvdTitle()
	{
		return dvdTitle;

	} // end method getdvdTitle

	// calculate total; override method total in Product
	public double total()
	{
		return getBasePrice() * getBaseAmount();

	} // end method total

	// calculate earnings; override method total in QtyProduct
	public double restock()
	{

	return getBasePrice() * 1.05;


	} // end method restock


	// return String representation of FeeQtyProduct object no longer needed
	public String toString()
	{
		return String.format( "%s: %s\n%s: %s",
		"Movie", super.toString(),
		"Dvd", getDvdTitle());

	} // end method toString

} // end class FeeQtyProduct

// create inventory list
class DvdInv
{

	// delare variables
	public static final int INVENTORY_SIZE = 30;
	private FeeQtyProduct[] items;
	public int numItems;

		DvdInv() //sets the number of items
		{

			items = new FeeQtyProduct[INVENTORY_SIZE];
			numItems = 0;

		}
		//returns number of items
		public int getNumItems()
		{
			return numItems;
		}

		//returns each product
		public FeeQtyProduct getFeeQtyProduct(int i)
		{
			return items[i];
		}

		//deletes item and recounts number of items
 		public void remove(int i)
		{

			items[i] = items[numItems -1];
			--numItems;

		}
		//adds products to the inventory
		public void addFeeQtyProduct( FeeQtyProduct item)
		{
			items[numItems] = item;
			++numItems;
		}
		// reduces numbers of items in inventory
		public void removeFeeQtyProduct(FeeQtyProduct item)
		{
			items[numItems] = item;
			--numItems;
		}
		// returns the amount one item inventory is worth
		public double value()
		{
			double sum = 0.0;

			for (int i = 0; i < numItems; i++)
			sum += items[i].total();

			return sum;

		}// end double value




} // end DvdInv

 // draw company logo
class ArcsJPanel extends JPanel
{

	public void paintComponent( Graphics g )
	{
		super.paintComponent( g ); // call superclass's paintComponent

		// draws larger 3d rectangle
		g.setColor( Color.RED );
		g.draw3DRect( 45, 15, 180, 40, true);

		// draws small black square
		g.setColor( Color.BLACK );
		g.draw3DRect( 5, 15, 40, 40, true );
		g.fill3DRect( 5, 15, 40, 40, false );

		//draws circle
		g.setColor( Color.RED );
		g.drawArc( 5, 15, 40, 40, 10, 360 );

		//fills circle
		g.setColor( Color.WHITE);
		g.fillArc( 5, 15, 40, 40, 10, 360 );

		// draws company name
		g.setColor( Color.BLACK );
		g.setFont( new Font( "Serif", Font.BOLD, 25 ) );
		g.drawString( "BS MUSIC INC.", 10, 45 );

	 } // end method paintComponent

 } // end class ArcsJPanel

// GUI for the Inventory
class DvdInvGUI extends JFrame
{


	private DvdInv myDvdInv;

	public int index = 0;

	// GUI elements to display information

	private final JLabel itemNumberLabel = new JLabel(" Item Number:");
	public JTextField itemNumberText;

	private final JLabel MovieLabel = new JLabel( "Movie:");
	private JTextField MovieText;

	private final JLabel DvdLabel = new JLabel("Dvd:");
	private JTextField DvdText;

	private final JLabel priceLabel = new JLabel(" Price: $");
	private JTextField priceText;

	private final JLabel qtyLabel = new JLabel(" Quantity:");
	private JTextField qtyText;

	private final JLabel valueLabel = new JLabel(" Value:");
	private JTextField valueText;

	private final JLabel restockFeeLabel = new JLabel(" with Restock Fee:");
	private JTextField restockFeeText;

	private final JLabel totalValueLabel = new JLabel(" Inventory Total Value:");
	private JTextField totalValueText;

	private final JLabel searchLabel = new JLabel("Search:");
	private JTextField searchText;




	// constructor for the GUI, in charge of creating all GUI elements
	DvdInvGUI(DvdInv inventory)
	{

		ArcsJPanel arcsJPanel = new ArcsJPanel(); // create ArcsJPanel
		final Dimension size = new Dimension(125,20);
		final Dimension size2 = new Dimension(300,60);
		final FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
		JPanel jpanel = new JPanel();
		JPanel  buttonPanel = new JPanel();
		buttonPanel.setLayout(new GridLayout(2, 4));
		JPanel centerPanel = new JPanel();
		centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));


		// create the inventory object that will hold the product information
		myDvdInv = inventory;

		// setup the GUI

		// product information
		// setup a panel to collect all the components.


		JButton firstButton = new JButton("First");
		buttonPanel.add(firstButton);

		JButton previousButton = new JButton("Previous");
		buttonPanel.add(previousButton);

		JButton nextButton = new JButton("Next");
		buttonPanel.add(nextButton);

		JButton lastButton = new JButton("Last");
		buttonPanel.add(lastButton);

		JButton addButton = new JButton("Add");
		buttonPanel.add(addButton);

		JButton deleteButton = new JButton("Delete");
		buttonPanel.add(deleteButton);

		JButton modifyButton = new JButton("Modify");
		buttonPanel.add(modifyButton);

		JButton saveButton = new JButton("Save");
		buttonPanel.add(saveButton);

		JButton searchButton = new JButton("Search");
		buttonPanel.add(searchButton);

		JButton helpButton = new JButton("help");
		buttonPanel.add(helpButton);

		// start JPanel layout
		jpanel = new JPanel(layout);
		arcsJPanel.setPreferredSize(size2);
		jpanel.add(arcsJPanel);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		itemNumberLabel.setPreferredSize(size);
		jpanel.add(itemNumberLabel);
		itemNumberText = new JTextField(3);
		itemNumberText.setEditable(false);
		jpanel.add(itemNumberText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		MovieLabel.setPreferredSize(size);
		jpanel.add(MovieLabel);
		MovieText = new JTextField(10);
		MovieText.setEditable(true);
		jpanel.add(MovieText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		DvdLabel.setPreferredSize(size);
		jpanel.add(DvdLabel);
		DvdText = new JTextField(10);
		DvdText.setEditable(true);
		jpanel.add(DvdText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		priceLabel.setPreferredSize(size);
		jpanel.add(priceLabel);
		priceText = new JTextField(10);
		priceText.setEditable(true);
		jpanel.add(priceText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		qtyLabel.setPreferredSize(size);
		jpanel.add(qtyLabel);
		qtyText = new JTextField(5);
		qtyText.setEditable(true);
		jpanel.add(qtyText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		restockFeeLabel.setPreferredSize(size);
		jpanel.add(restockFeeLabel);
		restockFeeText = new JTextField(5);
		restockFeeText.setEditable(false);
		jpanel.add(restockFeeText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		valueLabel.setPreferredSize(size);
		jpanel.add(valueLabel);
		valueText = new JTextField(5);
		valueText.setEditable(false);
		jpanel.add(valueText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		totalValueLabel.setPreferredSize(size);
		jpanel.add(totalValueLabel);
		totalValueText = new JTextField(5);
		totalValueText.setEditable(false);
		jpanel.add(totalValueText);
		centerPanel.add(jpanel);


		jpanel = new JPanel(layout);
		searchLabel.setPreferredSize(size);
		jpanel.add(searchLabel);
		searchText = new JTextField(10);
		searchText.setEditable(true);
		jpanel.add(searchText);
		centerPanel.add(jpanel);

		JFrame frame = new JFrame("Greatest Inventory Program of All Time"); // JFrame container
		frame.setLayout(new BorderLayout()); // set layout
		frame.add(buttonPanel, BorderLayout.SOUTH); // adds buttons to frame
		frame.add(centerPanel, BorderLayout.CENTER); // adds center panel to frame
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // terminate upon close
		frame.setSize(375, 425); // set size
		frame.setResizable(true);
		frame.setLocationRelativeTo(null); // set location
		frame.setVisible(true); // display the window
		repaintGUI();

	// start inner classes to add actions to buttons
	firstButton.addActionListener(new ActionListener() //goes to first entry
	{
		public void actionPerformed(ActionEvent e)
		{
			index = 0;
			repaintGUI();

		}// end action

	});// end class


	previousButton.addActionListener(new ActionListener() //allows user to add entry
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
				if (numItems != 0)
					index = (--index) % numItems;

					if (index < 0)
					index = numItems - 1;

				if (numItems == 0) // catches for last entry not needed because we add a blank entry at zero but just in case
					JOptionPane.showMessageDialog(null, "That's the last entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);

			repaintGUI();

		}// end action

	}); // end class

	nextButton.addActionListener(new ActionListener() //goes to next entry on the list
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
			index = (++index) % numItems; // moves index up one
			repaintGUI();


		}// end action

	}); // end class

	lastButton.addActionListener(new ActionListener()
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
			index = (numItems -1) % numItems; //goes to first entry then minus one
			repaintGUI();

		}// end action

	}); // end clas

	addButton.addActionListener(new ActionListener()
	{

		public void actionPerformed(ActionEvent e)
		{
			FeeQtyProduct temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);
			int numItems = myDvdInv.getNumItems() +1;

				index = (numItems - 2) % numItems;
				repaintGUI();


			if(MovieText.getText().equals("Add Movie Name" )) // catches for assigning more then one blank at a time
			{
				JOptionPane.showMessageDialog(null, "Please fill out the blank entry you already have before adding more\nRemember: Push Modify when you finish with your changes","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			}

			if(MovieText.getText().equals("Add Movie Name" ) !=true) // allows the adding of an entry
			{
				FeeQtyProduct product = new FeeQtyProduct( "Add Movie Name", Integer.parseInt(itemNumberText.getText()) + 1, 0, 0.0, "Add Dvd Title");
				index = (numItems - 1) % numItems;
				myDvdInv.addFeeQtyProduct(product );
				repaintGUI();
			}
			if (numItems == 29) // catches for going over static inventory size
			{
				myDvdInv.removeFeeQtyProduct(temp);
				JOptionPane.showMessageDialog(null, "Please No More Entries\n You can increase my capacity in the java file DvdInvApp.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			}

		}// end action

	}); // end class

	saveButton.addActionListener(new ActionListener() // saves the dat file in English
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
			InventoryStorage record = new InventoryStorage(); //calls inventroy storage class
			record.openFile();
			int currentRecord = 0; // keeps track of number of cycles

			do // cycles through the list adding them one at a time
			{
				record.addRecords();
				currentRecord = currentRecord + 1;
				index = (++index) % numItems;

			} while (currentRecord < numItems); //ends while

				record.closeFile(); //closes file
		}//end action

	});  // end class

	modifyButton.addActionListener(new ActionListener() // saves changes to the GUI
	{

		public void actionPerformed(ActionEvent e)
		{

			if (MovieText.getText().equals(""))  //traps for blank entry
			{
				JOptionPane.showMessageDialog(null, "Please Complete the Entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
			}


			if (DvdText.getText().equals(""))  //traps for blank entry
			{
				JOptionPane.showMessageDialog(null, "Please Complete the Entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
			}

			try // traps for letters and blank entry
			{

				Double.parseDouble(qtyText.getText());
				Double.parseDouble(priceText.getText());

				}
				catch (Exception d)
				{
				JOptionPane.showMessageDialog(null, "Recheck Entry use numbers for price and quantity.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
				}


			String name; int number; double amount, price; String title; // declares variables

			name = MovieText.getText();
			number = Integer.parseInt(itemNumberText.getText());
			amount = Double.parseDouble(qtyText.getText());
			price = Double.parseDouble(priceText.getText());
			title = DvdText.getText();


		FeeQtyProduct modify =  (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

			modify.setProductNumber(number);
			modify.setProductName(name);
			modify.setBaseAmount(amount);
			modify.setBasePrice(price);
			modify.setDvdTitle(title);
			repaintGUI();
		}

	}); // end class

	deleteButton.addActionListener(new ActionListener()  //allows user to delete entry and sorts product numbers to be in sequence
	{
		public void actionPerformed(ActionEvent e)
		{

			int numItems = myDvdInv.getNumItems();
			FeeQtyProduct temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

			if (numItems != 0)
			{

				if(Integer.parseInt(itemNumberText.getText()) != numItems)
				{

					myDvdInv.remove(index);
					repaintGUI();
					int i = Integer.parseInt(itemNumberText.getText());
					index = (++index) % numItems;
					repaintGUI();
					int j = Integer.parseInt(itemNumberText.getText());

					if (i > j)// my own little sort mechanism to keep Product numbers in sequence
						index = (-- index) % numItems;
						repaintGUI();
						temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);
						temp.setProductNumber(j-1);
						index = (++index) % numItems;
						repaintGUI();

				}// end if

				if(Integer.parseInt(itemNumberText.getText()) == numItems) // uses a different method to remove entry if it is the last one prevents blank entry from being in the mix
				{
					myDvdInv.removeFeeQtyProduct(temp);
					index = (++index) % numItems;
					repaintGUI();
				}//end if

			}// end if

			if (numItems == 1) // catches for 0 items error
			{

				FeeQtyProduct product = new FeeQtyProduct( "Add Movie Name",numItems, 0, 0.0, "Add Dvd Title");
				myDvdInv.addFeeQtyProduct(product);
				JOptionPane.showMessageDialog(null, "Delete Process Complete.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
			} //end if


		}// end action



	}); // end class

	searchButton.addActionListener(new ActionListener()
	{
		public void actionPerformed(ActionEvent e)
		{
			//declare variables and gets text from GUI
			String search = searchText.getText();
			String name = MovieText.getText();
			int number = Integer.parseInt(itemNumberText.getText());
			int numItems = myDvdInv.getNumItems();
			int currentRecord = 0;

			do // gets text and checks for a match
			{
				index = (++index) % numItems;
				repaintGUI();
				name = MovieText.getText();
				number = Integer.parseInt(itemNumberText.getText());
				search = searchText.getText();
				currentRecord = (++currentRecord);

				if(name.equalsIgnoreCase( search )) // stops on item
					repaintGUI();

				if(searchText.getText().equals("" )) //catches for no entry in the search box
				{
					JOptionPane.showMessageDialog(null, "You wanna search for nothing?","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
					index = (--index) % numItems;
					break;
				}

				if(currentRecord == numItems +1) // displays message if no results match search
				{
					JOptionPane.showMessageDialog(null, "No Results Found","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
					break;
				}


			}while(name.equalsIgnoreCase(search ) != true); //ends do while


		}//end action


	}); // end class

	helpButton.addActionListener(new ActionListener()  // this is basically to tell you what to do with the program
	{
		public void actionPerformed(ActionEvent e)
		{
			JOptionPane.showMessageDialog(null, "FIRST Brings you to the first entry\nPREVIOUS  Brings you to the last entry\nNEXT  Brings you to the next entry\nLAST Brings you to the last entry\nADD 			adds a blank entry to allow a new listing see (MODIFY)\nSAVE  Exports the entry's to a DAT file\nSEARCH allows you to search by product name\nMODIFY must be pressed to save changes 				within the GUI\nDELETE deletes the entry\nHELP  you are in help\n","HELP", JOptionPane.PLAIN_MESSAGE);
			repaintGUI();
		}

	}); // end class


} // end DvdInvGUI


class InventoryStorage // creates the output file
{
	private Formatter output; // object used to output text to file

		public void openFile()
		{
			try
			{
   				 String strDirectoy ="C://data/";

   				 // Create one directory
					boolean success = (new File(strDirectoy)).mkdir();

				if (success)
				{

						  JOptionPane.showMessageDialog(null, "we had to create a directory named data in your C drive.","That's affirmative", JOptionPane.PLAIN_MESSAGE);

 				   }   //end if


			 }//end try

			catch (Exception e)
			{


	 				 JOptionPane.showMessageDialog(null, "You do not have write access to the C: drive.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);

   			 }//end catch



			try
			{

						  output = new Formatter( "C:/data/inventory.dat");

			} // end try

		catch ( SecurityException securityException ) //catches for write access and exits program
		{
			JOptionPane.showMessageDialog(null, "You do not have write access to this file.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			System.exit( 1 );

		} // end catch

		catch ( FileNotFoundException filesNotFoundException ) //catches for write access and exits program
		{
			JOptionPane.showMessageDialog(null, "Please create a file named data in your c drive","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			System.exit( 1 );

		} // end catch


		JOptionPane.showMessageDialog(null, "file saved successfully.","That's affirmative", JOptionPane.PLAIN_MESSAGE);



	} // end method openFile

	public void addRecords() // adds the records to the file
	{

		FeeQtyProduct record = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

			// rounds the output numbers to 2 decimals

			BigDecimal roundPrice = new BigDecimal(Double.toString(record.restock() ));
			roundPrice = roundPrice.setScale(2, RoundingMode.HALF_UP);

			BigDecimal roundValue= new BigDecimal(Double.toString(record.total()));
			roundValue= roundValue.setScale(2, RoundingMode.HALF_UP);

			BigDecimal roundTotal= new BigDecimal(Double.toString(myDvdInv.value()));
			roundTotal = roundTotal.setScale(2, RoundingMode.HALF_UP);


		if (record != null) //catches for blank record - overkill because we can never have a blank record
		{
			output.format( "Movie:%s Product#: %s QTY#:%.0f Price: $%.2f%s: %s" ,
			record.getProductName(), record.getProductNumber(), record.getBaseAmount(), record.getBasePrice() ,
			" Dvd", record.getDvdTitle() + "  with restock Fee $" + (roundPrice) + "  value: $" + (roundValue) + " Inventory Total $" + (roundTotal) + "\t\n END OF LINE\t\t");

		} // end if


	} // end addRecords

	public void closeFile() // close the file
	{
		if ( output != null )
		output.close();

	} // end method closeFile

}// end InventoryStorage class


	// display GUI
	public void repaintGUI()
	{

		FeeQtyProduct temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

	if(temp != null) //catches for no entries
	{
		itemNumberText.setText("" + temp.getProductNumber());
		MovieText.setText(temp.getProductName());
		DvdText.setText(String.format("%s", temp.getDvdTitle()));
		priceText.setText(String.format("%.2f", temp.getBasePrice()));
		restockFeeText.setText(String.format("$%.2f", temp.restock()));
		qtyText.setText(String.format("%.0f",temp.getBaseAmount()));
		valueText.setText(String.format("$%.2f", temp.total()));


	}// end if
		totalValueText.setText(String.format("$%.2f", myDvdInv.value()));

	} // end repaintGUI

} // End InventoryGUI class 


I know know it looks a bit much But I do know where it is coming from. Lines 148. 155, 181, 836, and 863.

I know they are symbol errors as well, But i cannot think of what I missing?

Moderator Note: Edited topic title to be more descriptive.
- Core


Is This A Good Question/Topic? 0
  • +

Replies To: Fixing Code Errors

#2 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: Fixing Code Errors

Posted 28 February 2009 - 06:06 PM

Please post the exact errors messages along with stack traces that is being spit out at you, it will make tracking down the problems easier.
Was This Post Helpful? 0
  • +
  • -

#3 Nat3TheGreat13  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 162
  • Joined: 09-February 09

Re: Fixing Code Errors

Posted 28 February 2009 - 06:08 PM

Your String DvdTitle was lowercase in all those errors
this code works now

import java.awt.*;  // import the java awt package
import java.awt.event.*;  // Import the java event package
import javax.swing.*; // Import the java swing package
import java.util.*; // Import the java utility package
import java.io.*; // Import the java input output package
import java.lang.*; // Import the java lang package
import java.text.*; // Import the java text package
import java.math.*;  // Import the java math package

// starts the program sets up the intial inventory
public class DvdInvApp {



	// main method begins execution of java application
	public static void main(String[] args) {

	FeeQtyProduct product = null;
	DvdInv inventory = new DvdInv();

	product = new FeeQtyProduct( "Matrix",1, 12, 12.95, "First one" );
	inventory.addFeeQtyProduct(product );

	product = new FeeQtyProduct( "Matrix", 2, 8,  8.95, "Reloaded" );
	inventory.addFeeQtyProduct(product );

	product  = new FeeQtyProduct( "Matrix", 3, 4,  10.95, "Revolutions");
	inventory.addFeeQtyProduct(product );

	product  = new FeeQtyProduct( "StarWars", 4, 7, 11.95, "Episode 1" );
	inventory.addFeeQtyProduct(product );

	new DvdInvGUI(inventory); // open GUI

	} // end main

} // end DvdInvApp


abstract class Product
{
	public String productName; //name
	public int productNumber; // product number
	private double baseAmount; // quantity in Inv
	private double basePrice; // inital price

	 // four-argument constructor
	 public Product( String name, int number, double amount, double price  )
	{
		productName = name;
		 productNumber = number;
		baseAmount = amount;
		basePrice = price;

	} // end four-argument Product constructor

	 // set Product Name
	public void setProductName( String name )
	{
		productName = name;

	} // end method setProductName

	 // return ProductName
	public String getProductName()
	 {
		return productName;

	} // end method getProductName


	 // set ProductNumber
	public void setProductNumber( int number )
	{
		productNumber = number; // should validate

	} // end method setProductNumber


	 // return ProductNumber
	 public int getProductNumber()
	 {
		 return productNumber;

	} // end method getProductNumber

	// set initial price
	 public void setBaseAmount( double amount )
	{
		baseAmount = amount;

	} // end method setBaseAmount

	 // return BaseAmount
	public double getBaseAmount()
	{
		return baseAmount;

	} // end method getBaseAmount

	// set BasePrice
	 public void setBasePrice( double price )
	 {
		basePrice = price; // non-negative

	 } // end method setBasePrice

	 // return BasePrice
	 public double getBasePrice()
	{
		return basePrice;

	} // end method getBasePrice

	// return String representation of Product object no longer needed
	public String toString()
	{
		return String.format( "%s\nProduct#: %f\nQTY#:%.0f\nPrice: $%.2f ",
		 getProductName(), getProductNumber(), getBaseAmount(), getBasePrice() );

	 } // end method toString

	// abstract method overridden by subclasses

		public abstract double total(); // no implementation here
		public abstract double restock(); // no implementation here

} // end abstract class Product

class FeeQtyProduct  extends Product
{

	private String DvdTitle; // Dvd title

	// five-argument constructor
	 public FeeQtyProduct( String name, int number, double amount, double price, String title )
	 {
		super( name, number, amount, price );
		setDvdTitle( title);

	} // end five-argument FeeQtyProduct  constructor


	// set DvdTitle
	 public void setDvdTitle( String title )
	 {
		DvdTitle = title;

	 } // end method setDvdTitle

	 // return dvdTitle
	 public String getDvdTitle()
	{
		return DvdTitle;

	} // end method getdvdTitle

	// calculate total; override method total in Product
	public double total()
	{
		return getBasePrice() * getBaseAmount();

	} // end method total

	// calculate earnings; override method total in QtyProduct
	public double restock()
	{

	return getBasePrice() * 1.05;


	} // end method restock


	// return String representation of FeeQtyProduct object no longer needed
	public String toString()
	{
		return String.format( "%s: %s\n%s: %s",
		"Movie", super.toString(),
		"Dvd", getDvdTitle());

	} // end method toString

} // end class FeeQtyProduct

// create inventory list
class DvdInv
{

	// delare variables
	public static final int INVENTORY_SIZE = 30;
	private FeeQtyProduct[] items;
	public int numItems;

		DvdInv() //sets the number of items
		{

			items = new FeeQtyProduct[INVENTORY_SIZE];
			numItems = 0;

		}
		//returns number of items
		public int getNumItems()
		{
			return numItems;
		}

		//returns each product
		public FeeQtyProduct getFeeQtyProduct(int i)
		{
			return items[i];
		}

		//deletes item and recounts number of items
		 public void remove(int i)
		{

			items[i] = items[numItems -1];
			--numItems;

		}
		//adds products to the inventory
		public void addFeeQtyProduct( FeeQtyProduct item)
		{
			items[numItems] = item;
			++numItems;
		}
		// reduces numbers of items in inventory
		public void removeFeeQtyProduct(FeeQtyProduct item)
		{
			items[numItems] = item;
			--numItems;
		}
		// returns the amount one item inventory is worth
		public double value()
		{
			double sum = 0.0;

			for (int i = 0; i < numItems; i++)
			sum += items[i].total();

			return sum;

		}// end double value




} // end DvdInv

 // draw company logo
class ArcsJPanel extends JPanel
{

	public void paintComponent( Graphics g )
	{
		super.paintComponent( g ); // call superclass's paintComponent

		// draws larger 3d rectangle
		g.setColor( Color.RED );
		g.draw3DRect( 45, 15, 180, 40, true);

		// draws small black square
		g.setColor( Color.BLACK );
		g.draw3DRect( 5, 15, 40, 40, true );
		g.fill3DRect( 5, 15, 40, 40, false );

		//draws circle
		g.setColor( Color.RED );
		g.drawArc( 5, 15, 40, 40, 10, 360 );

		//fills circle
		g.setColor( Color.WHITE);
		g.fillArc( 5, 15, 40, 40, 10, 360 );

		// draws company name
		g.setColor( Color.BLACK );
		g.setFont( new Font( "Serif", Font.BOLD, 25 ) );
		g.drawString( "BS MUSIC INC.", 10, 45 );

	 } // end method paintComponent

 } // end class ArcsJPanel

// GUI for the Inventory
class DvdInvGUI extends JFrame
{


	private DvdInv myDvdInv;

	public int index = 0;

	// GUI elements to display information

	private final JLabel itemNumberLabel = new JLabel(" Item Number:");
	public JTextField itemNumberText;

	private final JLabel MovieLabel = new JLabel( "Movie:");
	private JTextField MovieText;

	private final JLabel DvdLabel = new JLabel("Dvd:");
	private JTextField DvdText;

	private final JLabel priceLabel = new JLabel(" Price: $");
	private JTextField priceText;

	private final JLabel qtyLabel = new JLabel(" Quantity:");
	private JTextField qtyText;

	private final JLabel valueLabel = new JLabel(" Value:");
	private JTextField valueText;

	private final JLabel restockFeeLabel = new JLabel(" with Restock Fee:");
	private JTextField restockFeeText;

	private final JLabel totalValueLabel = new JLabel(" Inventory Total Value:");
	private JTextField totalValueText;

	private final JLabel searchLabel = new JLabel("Search:");
	private JTextField searchText;




	// constructor for the GUI, in charge of creating all GUI elements
	DvdInvGUI(DvdInv inventory)
	{

		ArcsJPanel arcsJPanel = new ArcsJPanel(); // create ArcsJPanel
		final Dimension size = new Dimension(125,20);
		final Dimension size2 = new Dimension(300,60);
		final FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
		JPanel jpanel = new JPanel();
		JPanel  buttonPanel = new JPanel();
		buttonPanel.setLayout(new GridLayout(2, 4));
		JPanel centerPanel = new JPanel();
		centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));


		// create the inventory object that will hold the product information
		myDvdInv = inventory;

		// setup the GUI

		// product information
		// setup a panel to collect all the components.


		JButton firstButton = new JButton("First");
		buttonPanel.add(firstButton);

		JButton previousButton = new JButton("Previous");
		buttonPanel.add(previousButton);

		JButton nextButton = new JButton("Next");
		buttonPanel.add(nextButton);

		JButton lastButton = new JButton("Last");
		buttonPanel.add(lastButton);

		JButton addButton = new JButton("Add");
		buttonPanel.add(addButton);

		JButton deleteButton = new JButton("Delete");
		buttonPanel.add(deleteButton);

		JButton modifyButton = new JButton("Modify");
		buttonPanel.add(modifyButton);

		JButton saveButton = new JButton("Save");
		buttonPanel.add(saveButton);

		JButton searchButton = new JButton("Search");
		buttonPanel.add(searchButton);

		JButton helpButton = new JButton("help");
		buttonPanel.add(helpButton);

		// start JPanel layout
		jpanel = new JPanel(layout);
		arcsJPanel.setPreferredSize(size2);
		jpanel.add(arcsJPanel);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		itemNumberLabel.setPreferredSize(size);
		jpanel.add(itemNumberLabel);
		itemNumberText = new JTextField(3);
		itemNumberText.setEditable(false);
		jpanel.add(itemNumberText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		MovieLabel.setPreferredSize(size);
		jpanel.add(MovieLabel);
		MovieText = new JTextField(10);
		MovieText.setEditable(true);
		jpanel.add(MovieText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		DvdLabel.setPreferredSize(size);
		jpanel.add(DvdLabel);
		DvdText = new JTextField(10);
		DvdText.setEditable(true);
		jpanel.add(DvdText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		priceLabel.setPreferredSize(size);
		jpanel.add(priceLabel);
		priceText = new JTextField(10);
		priceText.setEditable(true);
		jpanel.add(priceText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		qtyLabel.setPreferredSize(size);
		jpanel.add(qtyLabel);
		qtyText = new JTextField(5);
		qtyText.setEditable(true);
		jpanel.add(qtyText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		restockFeeLabel.setPreferredSize(size);
		jpanel.add(restockFeeLabel);
		restockFeeText = new JTextField(5);
		restockFeeText.setEditable(false);
		jpanel.add(restockFeeText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		valueLabel.setPreferredSize(size);
		jpanel.add(valueLabel);
		valueText = new JTextField(5);
		valueText.setEditable(false);
		jpanel.add(valueText);
		centerPanel.add(jpanel);

		jpanel = new JPanel(layout);
		totalValueLabel.setPreferredSize(size);
		jpanel.add(totalValueLabel);
		totalValueText = new JTextField(5);
		totalValueText.setEditable(false);
		jpanel.add(totalValueText);
		centerPanel.add(jpanel);


		jpanel = new JPanel(layout);
		searchLabel.setPreferredSize(size);
		jpanel.add(searchLabel);
		searchText = new JTextField(10);
		searchText.setEditable(true);
		jpanel.add(searchText);
		centerPanel.add(jpanel);

		JFrame frame = new JFrame("Greatest Inventory Program of All Time"); // JFrame container
		frame.setLayout(new BorderLayout()); // set layout
		frame.add(buttonPanel, BorderLayout.SOUTH); // adds buttons to frame
		frame.add(centerPanel, BorderLayout.CENTER); // adds center panel to frame
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // terminate upon close
		frame.setSize(375, 425); // set size
		frame.setResizable(true);
		frame.setLocationRelativeTo(null); // set location
		frame.setVisible(true); // display the window
		repaintGUI();

	// start inner classes to add actions to buttons
	firstButton.addActionListener(new ActionListener() //goes to first entry
	{
		public void actionPerformed(ActionEvent e)
		{
			index = 0;
			repaintGUI();

		}// end action

	});// end class


	previousButton.addActionListener(new ActionListener() //allows user to add entry
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
				if (numItems != 0)
					index = (--index) % numItems;

					if (index < 0)
					index = numItems - 1;

				if (numItems == 0) // catches for last entry not needed because we add a blank entry at zero but just in case
					JOptionPane.showMessageDialog(null, "That's the last entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);

			repaintGUI();

		}// end action

	}); // end class

	nextButton.addActionListener(new ActionListener() //goes to next entry on the list
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
			index = (++index) % numItems; // moves index up one
			repaintGUI();


		}// end action

	}); // end class

	lastButton.addActionListener(new ActionListener()
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
			index = (numItems -1) % numItems; //goes to first entry then minus one
			repaintGUI();

		}// end action

	}); // end clas

	addButton.addActionListener(new ActionListener()
	{

		public void actionPerformed(ActionEvent e)
		{
			FeeQtyProduct temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);
			int numItems = myDvdInv.getNumItems() +1;

				index = (numItems - 2) % numItems;
				repaintGUI();


			if(MovieText.getText().equals("Add Movie Name" )) // catches for assigning more then one blank at a time
			{
				JOptionPane.showMessageDialog(null, "Please fill out the blank entry you already have before adding more\nRemember: Push Modify when you finish with your changes","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			}

			if(MovieText.getText().equals("Add Movie Name" ) !=true) // allows the adding of an entry
			{
				FeeQtyProduct product = new FeeQtyProduct( "Add Movie Name", Integer.parseInt(itemNumberText.getText()) + 1, 0, 0.0, "Add Dvd Title");
				index = (numItems - 1) % numItems;
				myDvdInv.addFeeQtyProduct(product );
				repaintGUI();
			}
			if (numItems == 29) // catches for going over static inventory size
			{
				myDvdInv.removeFeeQtyProduct(temp);
				JOptionPane.showMessageDialog(null, "Please No More Entries\n You can increase my capacity in the java file DvdInvApp.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			}

		}// end action

	}); // end class

	saveButton.addActionListener(new ActionListener() // saves the dat file in English
	{
		public void actionPerformed(ActionEvent e)
		{
			int numItems = myDvdInv.getNumItems();
			InventoryStorage record = new InventoryStorage(); //calls inventroy storage class
			record.openFile();
			int currentRecord = 0; // keeps track of number of cycles

			do // cycles through the list adding them one at a time
			{
				record.addRecords();
				currentRecord = currentRecord + 1;
				index = (++index) % numItems;

			} while (currentRecord < numItems); //ends while

				record.closeFile(); //closes file
		}//end action

	});  // end class

	modifyButton.addActionListener(new ActionListener() // saves changes to the GUI
	{

		public void actionPerformed(ActionEvent e)
		{

			if (MovieText.getText().equals(""))  //traps for blank entry
			{
				JOptionPane.showMessageDialog(null, "Please Complete the Entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
			}


			if (DvdText.getText().equals(""))  //traps for blank entry
			{
				JOptionPane.showMessageDialog(null, "Please Complete the Entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
			}

			try // traps for letters and blank entry
			{

				Double.parseDouble(qtyText.getText());
				Double.parseDouble(priceText.getText());

				}
				catch (Exception d)
				{
				JOptionPane.showMessageDialog(null, "Recheck Entry use numbers for price and quantity.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
				}


			String name; int number; double amount, price; String title; // declares variables

			name = MovieText.getText();
			number = Integer.parseInt(itemNumberText.getText());
			amount = Double.parseDouble(qtyText.getText());
			price = Double.parseDouble(priceText.getText());
			title = DvdText.getText();


		FeeQtyProduct modify =  (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

			modify.setProductNumber(number);
			modify.setProductName(name);
			modify.setBaseAmount(amount);
			modify.setBasePrice(price);
			modify.setDvdTitle(title);
			repaintGUI();
		}

	}); // end class

	deleteButton.addActionListener(new ActionListener()  //allows user to delete entry and sorts product numbers to be in sequence
	{
		public void actionPerformed(ActionEvent e)
		{

			int numItems = myDvdInv.getNumItems();
			FeeQtyProduct temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

			if (numItems != 0)
			{

				if(Integer.parseInt(itemNumberText.getText()) != numItems)
				{

					myDvdInv.remove(index);
					repaintGUI();
					int i = Integer.parseInt(itemNumberText.getText());
					index = (++index) % numItems;
					repaintGUI();
					int j = Integer.parseInt(itemNumberText.getText());

					if (i > j)// my own little sort mechanism to keep Product numbers in sequence
						index = (-- index) % numItems;
						repaintGUI();
						temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);
						temp.setProductNumber(j-1);
						index = (++index) % numItems;
						repaintGUI();

				}// end if

				if(Integer.parseInt(itemNumberText.getText()) == numItems) // uses a different method to remove entry if it is the last one prevents blank entry from being in the mix
				{
					myDvdInv.removeFeeQtyProduct(temp);
					index = (++index) % numItems;
					repaintGUI();
				}//end if

			}// end if

			if (numItems == 1) // catches for 0 items error
			{

				FeeQtyProduct product = new FeeQtyProduct( "Add Movie Name",numItems, 0, 0.0, "Add Dvd Title");
				myDvdInv.addFeeQtyProduct(product);
				JOptionPane.showMessageDialog(null, "Delete Process Complete.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
				repaintGUI();
			} //end if


		}// end action



	}); // end class

	searchButton.addActionListener(new ActionListener()
	{
		public void actionPerformed(ActionEvent e)
		{
			//declare variables and gets text from GUI
			String search = searchText.getText();
			String name = MovieText.getText();
			int number = Integer.parseInt(itemNumberText.getText());
			int numItems = myDvdInv.getNumItems();
			int currentRecord = 0;

			do // gets text and checks for a match
			{
				index = (++index) % numItems;
				repaintGUI();
				name = MovieText.getText();
				number = Integer.parseInt(itemNumberText.getText());
				search = searchText.getText();
				currentRecord = (++currentRecord);

				if(name.equalsIgnoreCase( search )) // stops on item
					repaintGUI();

				if(searchText.getText().equals("" )) //catches for no entry in the search box
				{
					JOptionPane.showMessageDialog(null, "You wanna search for nothing?","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
					index = (--index) % numItems;
					break;
				}

				if(currentRecord == numItems +1) // displays message if no results match search
				{
					JOptionPane.showMessageDialog(null, "No Results Found","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
					break;
				}


			}while(name.equalsIgnoreCase(search ) != true); //ends do while


		}//end action


	}); // end class

	helpButton.addActionListener(new ActionListener()  // this is basically to tell you what to do with the program
	{
		public void actionPerformed(ActionEvent e)
		{
			JOptionPane.showMessageDialog(null, "FIRST Brings you to the first entry\nPREVIOUS  Brings you to the last entry\nNEXT  Brings you to the next entry\nLAST Brings you to the last entry\nADD			 adds a blank entry to allow a new listing see (MODIFY)\nSAVE  Exports the entry's to a DAT file\nSEARCH allows you to search by product name\nMODIFY must be pressed to save changes				 within the GUI\nDELETE deletes the entry\nHELP  you are in help\n","HELP", JOptionPane.PLAIN_MESSAGE);
			repaintGUI();
		}

	}); // end class


} // end DvdInvGUI


class InventoryStorage // creates the output file
{
	private Formatter output; // object used to output text to file

		public void openFile()
		{
			try
			{
					String strDirectoy ="C://data/";

					// Create one directory
					boolean success = (new File(strDirectoy)).mkdir();

				if (success)
				{

						  JOptionPane.showMessageDialog(null, "we had to create a directory named data in your C drive.","That's affirmative", JOptionPane.PLAIN_MESSAGE);

					}   //end if


			 }//end try

			catch (Exception e)
			{


					  JOptionPane.showMessageDialog(null, "You do not have write access to the C: drive.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);

				}//end catch



			try
			{

						  output = new Formatter( "C:/data/inventory.dat");

			} // end try

		catch ( SecurityException securityException ) //catches for write access and exits program
		{
			JOptionPane.showMessageDialog(null, "You do not have write access to this file.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			System.exit( 1 );

		} // end catch

		catch ( FileNotFoundException filesNotFoundException ) //catches for write access and exits program
		{
			JOptionPane.showMessageDialog(null, "Please create a file named data in your c drive","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
			System.exit( 1 );

		} // end catch


		JOptionPane.showMessageDialog(null, "file saved successfully.","That's affirmative", JOptionPane.PLAIN_MESSAGE);



	} // end method openFile

	public void addRecords() // adds the records to the file
	{

		FeeQtyProduct record = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

			// rounds the output numbers to 2 decimals

			BigDecimal roundPrice = new BigDecimal(Double.toString(record.restock() ));
			roundPrice = roundPrice.setScale(2, RoundingMode.HALF_UP);

			BigDecimal roundValue= new BigDecimal(Double.toString(record.total()));
			roundValue= roundValue.setScale(2, RoundingMode.HALF_UP);

			BigDecimal roundTotal= new BigDecimal(Double.toString(myDvdInv.value()));
			roundTotal = roundTotal.setScale(2, RoundingMode.HALF_UP);


		if (record != null) //catches for blank record - overkill because we can never have a blank record
		{
			output.format( "Movie:%s Product#: %s QTY#:%.0f Price: $%.2f%s: %s" ,
			record.getProductName(), record.getProductNumber(), record.getBaseAmount(), record.getBasePrice() ,
			" Dvd", record.getDvdTitle() + "  with restock Fee $" + (roundPrice) + "  value: $" + (roundValue) + " Inventory Total $" + (roundTotal) + "\t\n END OF LINE\t\t");

		} // end if


	} // end addRecords

	public void closeFile() // close the file
	{
		if ( output != null )
		output.close();

	} // end method closeFile

}// end InventoryStorage class


	// display GUI
	public void repaintGUI()
	{

		FeeQtyProduct temp = (FeeQtyProduct) myDvdInv.getFeeQtyProduct(index);

	if(temp != null) //catches for no entries
	{
		itemNumberText.setText("" + temp.getProductNumber());
		MovieText.setText(temp.getProductName());
		DvdText.setText(String.format("%s", temp.getDvdTitle()));
		priceText.setText(String.format("%.2f", temp.getBasePrice()));
		restockFeeText.setText(String.format("$%.2f", temp.restock()));
		qtyText.setText(String.format("%.0f",temp.getBaseAmount()));
		valueText.setText(String.format("$%.2f", temp.total()));


	}// end if
		totalValueText.setText(String.format("$%.2f", myDvdInv.value()));

	} // end repaintGUI

} // End InventoryGUI class 


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1