Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Store odering program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nonamedude




PostPosted: Fri May 08, 2009 9:36 pm   Post subject: Store odering program

What is it you are trying to achieve?
<Uhmm ok i am new here and i am not that good at turing, i am learning it at high school. I got an assignment to do a program that allows the user to choose a product based on 16 different products and 12 different prices. >


What is the problem you are having?
<There are basically two problems i have
I dont know how to import images,
i dont know how to let the user to choose a product(by typing only a number) and then display both the name and price(without asking the user to input the name and price)
eg.
Product 1
product 2
Product 3

What product do u want? 1

Display
Product 1 20.00

Thats what i am trying to do>


Describe what you have tried to solve this problem
<Really stuck>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri May 08, 2009 9:40 pm   Post subject: RE:Store odering program

start with the Turing Walkthrough and see how far you get into it.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
nonamedude




PostPosted: Fri May 08, 2009 9:44 pm   Post subject: Re: Store odering program

Ok i figured out how to import using google, i know the basics like

counters , arrays , procedures, loops etc.. but i just got really stuck at the display part, i can make it display the product name but not the price...
Tony




PostPosted: Fri May 08, 2009 10:36 pm   Post subject: RE:Store odering program

how are you displaying the product name? And how is the price different from the name, in a way that doesn't let it be displayed by the same method?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
nonamedude




PostPosted: Sat May 09, 2009 9:10 am   Post subject: Re: Store odering program

ok the price will be real numbers and the name is string, i guees u know that, ok here an idea of what i am trying to achieve

Product Name Price
Image Product 1 10.00
'' Product 2 12.50
'' Product 3 14.00
'' Product 4 15.25
'' Product 5 16.25

How many poducts would u like to buy?
2
What product would u like 2 buy?1
What product would u like 2 buy?2

Display bill

Product 1 10.00
Product 2 12.50

if u still dont get what i am trying to achive i'll post my assignment question.
tjmoore1993




PostPosted: Sat May 09, 2009 10:16 am   Post subject: RE:Store odering program

You shouldn't approach the idea like that for the fact it would be a waste of a program. When programming try basing it off a real life situation. Your program is basically a grocery store... Right?

When you go to buy food from a grocery store the cashier will never ask you how many products would you like to buy. That would be totally messed up, instead you look for the things you need and add them into your shopping cart.

Why not have some sort of shopping cart system...

Example:
Turing:

var Selection : int
var Picture : array 1 .. 3 of int
var Information : array 1 .. 3, 1 .. 2 of real
var Height : int
var Cost : real := 0
var Add : char

Picture (1) := Pic.FileNew ("C:\\Example.bmp")
Information (1, 1) := 5.99
Picture (2) := Pic.FileNew ("C:\\Example.bmp")
Information (2, 1) := 6.94
Picture (3) := Pic.FileNew ("C:\\Example.bmp")
Information (3, 1) := 7.25
loop
    loop
        cls
        put "Total Cost : ", Cost
        put "1 - Dog food"
        put "2 - Carrots"
        put "3 - Candy"
        get Selection
        if Selection >= 4 or Selection <= 0 then
        else
            Pic.Draw (Picture (Selection), maxx div 2, maxy div 2, 0)
            Height := Pic.Height (Picture (Selection))
            locatexy ((maxx div 2) - (25), (maxy div 2) - (Height div 4))
            put "Price : $", Information (Selection, 1)
            put "Would you like to add this item to your cart? (Y/N)"
            get Add
            exit when Add = 'y' or Add = 'Y'
        end if
    end loop
    Cost += Information (Selection, 1)
end loop


The last step is to have a list of things you bought. I will not help you there. Good luck Smile
Tony




PostPosted: Sat May 09, 2009 12:47 pm   Post subject: RE:Store odering program

@nonamedude you haven't answered why real numbers can't be displayed by the same method as strings.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
nonamedude




PostPosted: Sat May 09, 2009 8:42 pm   Post subject: Re: Store odering program

Ok here is my assignment

Store Ordering System
You will be creating an ordering system for a store of your choice (e.g. clothing, CD?s, movies, etc.). Your store will sell a minimum of 16 different items at 12 different prices. You need to choose a unique name for your store and create an address.
- print your company?s name centered on the output screen, and the company?s address aligned on the right of the output screen
- give a brief introduction explaining who your company is and the type of products that you sell
- ask the user for their full name and billing address
- give a list of all items with prices that is neatly aligned in 2-3 columns on the output screen
- ask the user which item they would like to order, how many of this item and then display the cost for that item and the total (before tax) of the bill so far
- the user may order as many items as they want from your store
- be sure to clear the screen in appropriate spots
- when the user is finished placing their order you need to print out a final bill for the user which will show your company?s information including a small graphical logo, the user?s information, all the items ordered, the number of each item ordered, the cost for ordering each item, the total before tax, amount of GST and PST, and the final amount owed

ok @ tony i know how to display the real numbers but i don't know how to display without asking the user for the input(ask the user the price of the object)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat May 09, 2009 8:46 pm   Post subject: RE:Store odering program

If you don't ask, then where does the number come from? Can you display that?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
nonamedude




PostPosted: Sat May 09, 2009 8:48 pm   Post subject: Re: Store odering program

i tested the program i figured out everything but i still did nt learn wat this means

Information (1, 1) := 5.99

Information (2, 1) := 6.94

Information (3, 1) := 7.25

what does the (x,y) stand for?

and thanks it gave me a better idea on how to do my project
Tony




PostPosted: Sat May 09, 2009 8:54 pm   Post subject: RE:Store odering program

x and y are indexes of a 2D array.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dusk Eagle




PostPosted: Sat May 09, 2009 11:23 pm   Post subject: Re: Store odering program

...which is explained here.
nonamedude




PostPosted: Sun May 10, 2009 12:27 pm   Post subject: Re: RE:Store odering program

ok i'll try and go throug the walkthorugh and come back if i still have doubts.
nonamedude




PostPosted: Tue May 12, 2009 9:56 pm   Post subject: Re: Store odering program

I figured everthing out, thanks a lot guys, my bad i did nt go through the walkthrough(i hav no patience)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: