Shop

• November 13th, 2012, 08:30 AM
anis.laghaei
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 ?
• November 13th, 2012, 08:33 AM
KevinWorkman
Re: Shop
We can try to help you, but you have to ask us a question first.
• November 13th, 2012, 08:43 AM
anis.laghaei
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?
• November 13th, 2012, 08:47 AM
KevinWorkman
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?
• November 13th, 2012, 11:20 AM
anis.laghaei
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 ?
• November 13th, 2012, 11:30 AM
KevinWorkman
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.
• November 13th, 2012, 01:32 PM
anis.laghaei
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
• November 13th, 2012, 05:46 PM
jps
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?