Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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
 
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
 
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




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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.