Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

SportsItem

Thread view: 
Iyara - 08 Nov 2005 02:11 GMT
I am trying to construct the SportsItem class but i keep getting
illegal type error.
Where am i going wrong? I need to include the variables description,
price, Stock Quantity, Stock reorder level and i think string supplier.

 //
 * author (Stephen Downes)
 * version (7th November 2005);
 */

public class sportsItem
{

    private String Description;
    private String Price;
    private int Quantity;
    private int quantityReorder;
    private String Supplier;

    /**
    * Constructor for objects of class item
    */
here' the error    public sportsItem(String Description, String Price,
int Quantity, int quantityReorder, String Supplier)
    )

    {

       this.sportsitem= sportsItem;
       this.description= description;
       this.quantity= quantity;
       this.quantityReorder= reorderQuantity;

    }

    public String getItem;
    {
       return item;
      }

    public String getDescription;
    {
       return description;
      }

   public int getQuantity()
    {
       return quantity;
      }

    public int getquantityReorder()
    {
       return quantityReorder;
      }
Benji - 08 Nov 2005 02:18 GMT
> I am trying to construct the SportsItem class but i keep getting
> illegal type error.
> Where am i going wrong? I need to include the variables description,
> price, Stock Quantity, Stock reorder level and i think string supplier.

capitalize class names ALWAYS.

>        this.sportsitem= sportsItem;

sportsItem is your class name.  what are you trying to do here?  this
doesn't make any sense.

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Iyara - 08 Nov 2005 02:35 GMT
I am trying to construct a class SportsItem and then create a class
Supplier, in order to instruct the SportsItem class to reduce the
quantity of stock when an item is sold.
In my SportsItem class I have (description, price, quantity in stock,
reorder quantity and supplier). In the Supplier class i have variables
( name, phoneNumber and e-mail address).
I am trying to set it up so when i go to inspect the SportsItem i can
call the Supplier of that item and relevant details.

i know this sounds so basic, but im a beginner and would appreciate an
advice.
IchBin - 08 Nov 2005 02:46 GMT
> I am trying to construct the SportsItem class but i keep getting
> illegal type error.
> Where am i going wrong? I need to include the variables description,
> price, Stock Quantity, Stock reorder level and i think string supplier.

Try this. Just slow down and look at CAPS and ;'s

public class sportsItem {
   
    private String    description;
    private String    price;
    private int    quantity;
    private int    quantityReorder;
    private String    supplier;
    private String    sportsitem;
   
    /**
    * Constructor for objects of class item
    */
   
    public sportsItem(String sportsItem, String description, String price,
            int quantity, int quantityReorder, String supplier) {
       
        this.sportsitem         = sportsItem;
        this.description         = description;
        this.price             = price;
        this.quantity             = quantity;
        this.quantityReorder        = quantityReorder;
        this.supplier             = supplier;
    }
   
    public String getSportsItem()    {
        return this.sportsitem;
    }
    public String getDescription()    {
        return this.description;
    }
    public String getPrice()    {
        return this.price;
    }
    public int getQuantity() {
        return this.quantity;
    }
    public int getQuantityReorder() {
        return this.quantityReorder;
    }
    public String getSupplier() {
        return this.supplier;
    }
}

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Iyara - 08 Nov 2005 02:51 GMT
Dank u , ich bin.
Will take your advice
iyara
IchBin - 08 Nov 2005 03:05 GMT
> Dank u , ich bin.
> Will take your advice
> iyara

Just one more thing. For the problems you are have keep them to the
comp.lang.java.help group. That group are for Java beginners. And do not
cross post.

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Iyara - 08 Nov 2005 03:05 GMT
I'm also stuck on how to relate the Supplier classpublic class supplier
{
    // the suppliers full name
    private String name;
    // the suppliers phone number
    private string phoneNumber;
    // the suppliers email address
    private string emailAddress;
    private string sportsItem;

    /**
     * Create a new supplier with a given name, phone number and
e-mail address.
     */
    {

    Public supplier (String fullName, String phoneNumber, String
emailAddress)
    {
        name = fullName;
        phonenumber = phoneNumber;
        emailaddress = emailAddress;
        Item = 0;
        this.supplier = supplier;
    }

    /**
     * Return the full name of this supplier.
     */
    public String getName()
    {
        return name;
    }

    /**
     * Set a new name for this supplier.
     */
    public void changeName(String replacementName)
    {
        name = replacementName;
    }

    /**
     * Return the phoneNumber of this supplier.
     */
    public String getphoneNumber;
    {
        return phoneNumber;
    }

    /**
     * Substract items from StockQuantity
     */
    public void reduceStock(int )
    {
        stock += ;
    }

    /**
     * Return the number of items in stock.
     */
    public int getStockQuantity()
    {
        return stockQuantity;
    }

    /**
     * Return the login name of this student. The login name is a
combination
     * of the first four characters of the student's name and the
first three
     * characters of the student's ID number.
     */
    public String getquantityReorder()
    {
        return name.substring(0,4) + id.substring(0,3);
    }

    /**
     * Print the suppliers phone number and email address.
     */
    public void print()
    {
        System.out.println(name + " (" + phoneNumber + ")");
        System.out.println("Suppliers name is:  " +
SportsItem.getName());
        System.out.println("Suppliers emailAddress is:  " +
SportsItem.getemailAddress());
    }
}

to the sportsItem class. this so far
Benji - 08 Nov 2005 03:14 GMT
> I'm also stuck on how to relate the Supplier classpublic class supplier
> <snip 100 lines of code>
>  to the sportsItem class. this so far

OK, seriously,
1) post to comp.lang.java.help (or just work on learning java instead of
  asking for help whenever you get a compiler error message)
2) put some work into it when you post.  how on earth are we supposed to
  read a sentence that has 100 lines of code in the middle of it?
3) Capitalize your class names.  Use lower case for variable names.  It's
  impossible to read your code.

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Benji - 08 Nov 2005 03:29 GMT
> I'm also stuck on how to relate the Supplier classpublic class supplier
> <snip 100 lines of code>
>  to the sportsItem class. this so far

OK, seriously,
1) post to comp.lang.java.help (or just work on learning java instead of
  asking for help whenever you get a compiler error message)
2) put some work into it when you post.  how on earth are we supposed to
  read a sentence that has 100 lines of code in the middle of it?
  You didn't even bother to hit <enter> before you pasted the code.
3) Capitalize your class names.  Use lower case for variable names.  It's
  impossible to read your code.

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

IchBin - 08 Nov 2005 03:43 GMT
>> I'm also stuck on how to relate the Supplier classpublic class supplier
>> <snip 100 lines of code>
[quoted text clipped - 8 lines]
> 3) Capitalize your class names.  Use lower case for variable names.  It's
>    impossible to read your code.

Benji is correct. Do not post to this group. Post to
comp.lang.java.help. I helped with your first class. You are making the
same mistakes in this other class. So slow down and see what I changed
and what you tried to do initially.

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Iyara - 08 Nov 2005 04:23 GMT
sorry about inconvience, wont post to this group again.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.