Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Shop

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Shop

    Hello
    I have to write a program for confectionary.
    And i have to write with Inheritance and polymorphism.
    this is topic that i have to write :
    classes of : 1)sweet 2)Biscuits 3) ice cream => should extend from PastryItem Class.
    and also about cost, the system should calculate.
    for example for sweet, if we choose 1500(gr) then the system should know that the the price of each kilo is : 10,000$ the the price of buy will be 15000$ .
    can you help me ?


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Shop

    We can try to help you, but you have to ask us a question first.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Shop

    ok.
    this is my question : how can i do this :
    we choose Biscuit and then choose type of it(for example "Hi Bye")then choose the amount (for example 2 bags) so how can i calculate it?

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Shop

    That's a pretty open question, and it's going to depend entirely on your context, which we don't know. Which part of this are you having trouble with? Getting input from a user? Matching types of Objects (Biscuits) with their attributes (prices)? Something else? Are you doing this via a gui, or via the command prompt, or hard coding everything? What have you tried? What does your code do now?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Shop

    ok let me explain you in this way :
    just think you come to my shop and ask for 2 bags of biscuit, so i type biscuit -> 2 bags , then will tell how much money you should pay!
    now: we have to write one class for biscuit which extend from superclass,named : "PasetryItem" and also should have another class with name: "Payment" that can calculate .
    got it ?

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Shop

    I guess, but again, what's your actual question? You've posted your homework, or at least part of it, but you haven't told us where you're stuck or what you've tried. Break your problem down into smaller steps, then take those steps one at a time.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Shop

    ok
    Write program for shop that sell just Biscuit , in this program ,user of this program will choose which biscuit (for example "x") that the price is 10$ then will give you the whole money you should pay.
    PS:you should write it with inheritance

  8. #8
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Shop

    In 4 posts you have not asked a question. (Posting your instructions is not asking a question.)
    As a bystander reading this thread, I am curious what your question is.
    What have you done so far? Do you have a plan written out and organized? Have you started any code?

Similar Threads

  1. Job Shop Production Scheduling
    By bolsover in forum Algorithms & Recursion
    Replies: 1
    Last Post: December 5th, 2012, 03:34 AM