Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-30-2007, 07:30 AM
Member
 
Join Date: Jul 2007
Posts: 5
Nexcompac is on a distinguished road
Adding a Restock Fee
I am getting I believe three erros in this code. I had it running perfect untill I added all the restock fee items.

This is what I have so far:

Code:
import java.util.*; // program uses class Scanner public class Inventory { // main method begins execution of Java application public static void main( String args[]) { product[] myProduct = new product[5]; product p1 = new product("Tom Clancy Vegas", 20003, 5, 30); product p2 = new product("Froger", 74512, 2, 10); product p3 = new product("Halo 2", 20009, 3, 45); product p4 = new product("Night Caster", 74522, 8, 5); product p5 = new product("Halo 3", 32976, 1, 50); myProduct[0] = p1; myProduct[1] = p2; myProduct[2] = p3; myProduct[3] = p4; myProduct[4] = p5; double totalValue = 0.0; for (int c=0; c < 5; c++) { totalValue = totalValue + myProduct[c].itemCalculate(); } Arrays.sort(myProduct); // function used to sort arrays for(product p: myProduct) { System.out.println(p); System.out.println(); } System.out.println("Total Inventory value is: $"+totalValue); } //end main } //end Inventory
Code:
import java.util.*; // program uses any class available class product implements Comparable { private String productName; // class variable that stores the item name private int itemNumber; // class variable that stores the item number private double unitProduct; // class variable that stores the quantity in stock private double priceProduct; // class variable that stores the item price /** Creates a new instance of product */ public product() // Constructor for Product class { productName = ""; itemNumber = 0; unitProduct = 0.0; priceProduct = 0.0; } public product( String productName, int itemNumber, double unitProduct, double priceProduct) // Constructor for myProduct class { this.productName = productName; this.itemNumber = itemNumber; this.unitProduct = unitProduct; this.priceProduct = priceProduct; } public void setProductName(String name) // Method to set the item name { this.productName = productName; } public String getProductName() // Method to get the item name { return productName; } public void setItemNumber(int number) // Method to set the item number { this.itemNumber = itemNumber; } public int getItemNumber() // Method to get the item name { return itemNumber; } public void setUnitProduct(double unit) // Method to set the item number { this.unitProduct = unitProduct; } public double getUnitProduct() // Method to get the item name { return unitProduct; } public void setPriceProduct(double price) // Method to set the item number { this.priceProduct = priceProduct; } public double getPriceProduct() // Method to get the item name { return priceProduct; } public double setRestockFee() // Method to set the Restocking fee { return value() * 0.05; } public double getRestockFee() // Method to set the Restocking fee { return value() * 0.05; } // Calculation method public double itemCalculate() { return unitProduct * priceProduct; // multiply for total for each item } // end calculation public int compareTo (Object o) // use the compareTo method { product p = (product)o; return productName.compareTo(p.getProductName()); } public double RestockFee() // Method to set the Restocking fee { return value() * 0.05; } // end public String toString() // displays products { return "Title: "+productName+ "\nBarcode: "+itemNumber+ "\nNumber of Xbox games: "+(int)unitProduct+ "\nPrice: $"+priceProduct+ "\nTotal: $"+itemCalculate(); } // end toString }//end class Supplies

Last edited by Nexcompac : 07-30-2007 at 09:17 AM. Reason: posted wrong code
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-30-2007, 09:18 AM
Member
 
Join Date: Jul 2007
Posts: 5
Nexcompac is on a distinguished road
here are the error codes
Product.java:61 cannot find symbol
symbol : method value<>
location: class product
return value<> * 0.05;

Product.java:65 cannot find symbol
symbol : method value<>
location: class product
return value<> * 0.05;

Product.java:82 cannot find symbol
symbol : method value<>
location: class product
return value<> * 0.05;
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-31-2007, 03:46 PM
Member
 
Join Date: Jul 2007
Posts: 5
Nexcompac is on a distinguished road
Holy crap, no help at all?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding taglibs in JSP Java Tip Java Tips 0 01-14-2008 12:43 AM
Adding Tabs to JTabbedPane blackstone AWT / Swing 2 11-14-2007 04:15 PM
Adding file names(Help!!) Gambit17 New To Java 4 11-09-2007 08:26 AM
Adding Variables and using Switch notnumber6 New To Java 4 11-03-2007 06:45 PM
Adding items to a jComboBox tronovan New To Java 0 08-08-2007 09:48 AM


All times are GMT +3. The time now is 10:49 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org