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

Username:   Password: 
 RegisterRegister   
 Calculating pay per weekly hours
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lucklesslily




PostPosted: Wed Oct 28, 2015 9:15 am   Post subject: Calculating pay per weekly hours

I can't figure out how to do something in Turing, I'm trying to write out a program that calculates the weekly pay for an employee. So if they work 20 hours or less they're payed $9/h, etc.

It looked like this @ one point:

if workHours <= 20
then workHours * 9
elsif workHours > 20
then workHours * 11
elsif workHours >= 40
then workHours * 17
end if

and obviously it's not working, but I can't seem to find out how else to figure out the weekly pay per hours... Embarassed
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Oct 29, 2015 12:11 am   Post subject: RE:Calculating pay per weekly hours

Quote:
then workHours * 9


The problem here is that you're creating a new value by multiplying two numbers together, but you're not storing that value in a variable. Maybe call that variable 'pay'. Then that line should look like this:

then pay := workHours * 9
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  [ 2 Posts ]
Jump to:   


Style:  
Search: