Computer Science Canada

tip calculator

Author:  ephraim613 [ Mon May 04, 2009 8:45 pm ]
Post subject:  tip calculator

What is it you are trying to achieve?
a program that will calculate tips for people (I work in a cafe)


What is the problem you are having?
figuring out how to essentially merge a program that does calculate tips but one person at a time, and the run window is very cluttered, with a program I did years ago when I was learning Turing and understood it better (4 years ago!) that takes n number of students names, grades, averages, and genders and then out puts them into a nice neat grid.


Describe what you have tried to solve this problem
I've tried various copy and pastes of the tip program into the array program with very little success.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
I'll post the tip calculator code here as its short, but the array program will be attached as its 59 lines

Turing:


%calculates the tips for the week for a person
put "Please enter the total amount of tips for the week"
var weektotal : real
get weektotal
loop
    put "Enter the partner's name"
    put "(or number if the name is not available) that is on the sheet,"
    put "then enter the percent as shown on the print out."
    put "Repeat for the next partner"
    var partner : string
    var percent : real
    var tips : real
    get partner, percent
    tips := weektotal * percent
    put "the tips ", partner, " has is $", tips
end loop




Please specify what version of Turing you are using
I'm using v4.1.1

Author:  tjmoore1993 [ Tue May 05, 2009 3:29 pm ]
Post subject:  RE:tip calculator

Please setup a scenario because you are not making sense. When making a small program like this you should use several different variables. You can join them as an array...

Also it helps if you make the problem more specific Smile


: