Results 1 to 3 of 3
  1. #1
    piyush_jeena is offline Member
    Join Date
    Jul 2013
    Location
    noida
    Posts
    1
    Rep Power
    0

    Default facing error for public static void main(string[])

    class Product
    {
    int qty,code,sprice,cprice;
    static int profit,collection;


    static void set (int c)
    {
    collection=c;
    }

    void doSales (int unit)
    {
    if (qty>=unit)
    {
    qty-=unit;
    collections=collections+sprice *
    unit;
    profit=unit+(sprice-cprice);
    s.o.pln(code+ "product sales");
    return;}
    s.o.pln("insufficient quantity");
    }

    void doPurchase(int unit)
    {
    if (collection>=(unit*cprice))
    {
    qty+=unit;
    collection-=unit*cprice;
    s.o.pln(code + "product purchase");
    return;
    }
    s.o.pln("insufficent collection");
    }
    static void addCollection(int amt)
    {
    collection+=amt;
    }
    static void show()
    {
    s.o.pln("\n\n total collection: "+collection);
    s.o.pln("profit: "+profit);
    }
    void showProduct()
    {
    s.o.pln("\ncode: "+code);
    s.o.pln("quantity: "+qty);
    s.o.pln("sales price: "+sprice);
    }
    void setProduct(int c,int cp,int sp,int q)
    {
    code=c;
    cprice=cp;
    sprice=cp;
    qty=q;
    }
    public satic void main(string[])
    {
    set(10000);
    Product p1,p2,p3;
    p1 = new product();
    p2 = new product();
    p3 = new product();

    p1.setProduct(101,100,120,50);
    p2.setProduct(102,500,550,20);
    p3.setProduct(103,1000,1100,10);

    p3.doSales(5);
    p1.doSales(60);
    p3.doSales(10);

    p1.doPurchase(5);
    p2.doPurchase(20);
    p3.doPurchase(20);

    p1.showProduct();
    p2.showProduct();
    p3.showProduct();

    }

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: facing error for public static void main(string[])

    You spelled "static" wrong. There may be other errors, that was just the first thing I spotted.

    In the future, please use code tags and post the full text of your error messages.
    Get in the habit of using standard Java naming conventions!

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: facing error for public static void main(string[])

    Quote Originally Posted by kjkrum View Post
    There may be other errors
    Yeah, like s.o.pln(...).

    @piyush_jeena: start frm the beginning and work your way up: The Java™ Tutorials

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. public static void main(String... args)???
    By SnakeDoc in forum New To Java
    Replies: 5
    Last Post: 01-10-2013, 08:30 AM
  2. Q?> about public static void main(String args[])
    By boblingwide in forum New To Java
    Replies: 4
    Last Post: 03-23-2012, 11:17 AM
  3. Replies: 10
    Last Post: 07-10-2011, 08:37 AM
  4. Public static void main (String args[])
    By arefeh in forum New To Java
    Replies: 12
    Last Post: 01-28-2010, 11:58 AM
  5. Replies: 9
    Last Post: 11-22-2008, 11:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •