Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 13th, 2006, 06:53 PM
Registered User
 
Join Date: Oct 2006
Location: Taylorsville, KY, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invoice Set & Get Method

Hey guys, I am a newbie. I created a Invoice app. with sets and gets. I know that it is ok, its my Invoice test I am trying to run and I get errors like crazy. I am using the book Small Java 6th Edition, Chapter 3, Lab 3.13. Any help would be appreciated.

Thanks

John
Reply With Quote
  #2 (permalink)  
Old October 13th, 2006, 08:53 PM
Registered User
 
Join Date: Oct 2006
Location: Taylorsville, KY, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I guess I could have showed what I was doing hehe.

// John Rogers

public class Invoice
{
   private String partNumber;
   private int quantity;
   private String partDescription;
   private double pricePerItem;

   public void setpartNumber( String name )
   {
      partNumber = name;
   }

   public String getpartNumber()
   {
      return partNumber;
   }

   public void setpartQuantity( int quant )
   {
      if ( quant < 0 )
         {quant = 0;}
      quantity = quant;
   }

   public int getpartQuantity()
   {
      return quantity;
   }

   public void setDescription( String desc )
   {
      partDescription = desc;
   }

   public String getpartDescription()
   {
      return partDescription;
   }

   public void setpricePerItem( double price )
   {
      if ( price < 0.0)
      { price = 0.0; }
      pricePerItem = price;
   }

   public double getpricePerItem()
   {
      return pricePerItem;
   }

}
      This worked when i ran it. This is the InvoiceTest that I cant figure out

// John Rogers
// CH3 Lab 3.13 Invoice Test

public class InvoiceTest
{

   public static void main( String args [] )
   {

      Scanner input = new Scanner( System in );

      Invoice myInvoice = new Invoice

      System.out.printf( "



John
Reply With Quote
  #3 (permalink)  
Old October 13th, 2006, 09:50 PM
Authorized User
 
Join Date: Jul 2006
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ironchef
Default

I'm no expert on what you're working with, but shouldn't you add '();' after line 9?

IronChef - http://www.freewebs.com/cool_recipes
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in Checkbox Combination & sorting method.. akshaymehta007 Classic ASP Professional 0 December 28th, 2007 01:32 AM
Best method to store date & Time with SQL 2000 harini19 Java Basics 0 February 15th, 2006 12:52 AM
Optimized method to post data & format into Excel shampabera Excel VBA 1 July 14th, 2005 09:23 AM
Re: need a correct method to set filter flyfish Access 2 January 28th, 2005 06:32 AM
Javascript SET Method? TSEROOGY Javascript How-To 2 February 7th, 2004 09:20 PM



All times are GMT -4. The time now is 10:34 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.