New guy just learning
Author |
Message |
Micro
|
Posted: Mon Feb 28, 2011 9:42 pm Post subject: New guy just learning |
|
|
I've just started using Turing for only about 2 weeks ago. But i still haven't gotten the hang of it.
I am to create a program that calculates a person's total income after working at Macdonald's. I'm not sure if i have the program right. But i was wondering if i could post it here and someone would take a look at it and possibly give me some ways of improving it. For example. I want the gross income to be displayed at a different time as take home profit. The same goes for the thank you part.
Here it is.
(I'm a noob at this so please be nice)
code: | %This program will display the worker's total income and his/her take home profit for Macdonalds.
var Hours_Worked, Paid_Per_Hour, Income_Tax, Canada_Pension_Plan, Income_Tax_Rate, Gross_Profit: real
colour (brightred)
put "How many hours did you work for?"
get Hours_Worked
colour (green)
put "What was your hourly salary?"
get Paid_Per_Hour
colour (80)
put "Please input your income tax"
get Income_Tax
colour (20)
put "How much does your Canadian Pension Plan cost?"
get Canada_Pension_Plan
colour (15)
put "What is your income tax rate?"
get Income_Tax_Rate
colour (50)
put "Your gross income is ", Hours_Worked*Paid_Per_Hour
put "Your take home profit will be ", "$", Hours_Worked*Paid_Per_Hour-Income_Tax-Canada_Pension_Plan-Income_Tax_Rate
locate (19,25)
put "Thank you for using our services." |
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
huskiesgoaler34

|
Posted: Tue Mar 01, 2011 2:23 pm Post subject: Re: New guy just learning |
|
|
You can add a delay between your put statements.
delay (1000).
This will delay the program from outputting the next statement. |
|
|
|
|
 |
mirhagk
|
Posted: Tue Mar 01, 2011 4:14 pm Post subject: RE:New guy just learning |
|
|
or you could use Input.Pause if you want the classic press any key to continue |
|
|
|
|
 |
Micro
|
Posted: Tue Mar 01, 2011 5:40 pm Post subject: Re: New guy just learning |
|
|
Thanks for the help. But i've learnt a lot in class today and i've edited to it to my liking.
Tell me what you think
code: | var Hours_Worked, Paid_Per_Hour, Income_Tax, Canada_Pension_Plan, Income_Tax_Rate, Gross_Profit : real
Draw.FillBox (0 , 0, maxx , maxy, black)
colourback(black)
colour (brightgreen)
put "How many hours did you work in one week?"
get Hours_Worked
cls
colour (brightgreen)
put "What is your hourly salary?"
get Paid_Per_Hour
cls
colour (brightgreen)
put "Please input your income tax."
get Income_Tax
cls
colour (brightgreen)
put "How much does your Canadian Pension Plan cost?"
get Canada_Pension_Plan
cls
colour (brightgreen)
put "What is your income tax rate?"
get Income_Tax_Rate
cls
var font1 : int
font1 := Font.New ("Times New Roman:0:Bold")
Font.Draw ("Calculating...", 275, 275, font1, brightgreen)
delay(2000)
cls
colour(brightgreen)
locate (10, 25)
put "Your gross income is ", "$", Hours_Worked * Paid_Per_Hour,"."
delay(1000)
colour(brightgreen)
locate (11, 25)
put "Your take home pay will be ", "$", Hours_Worked * Paid_Per_Hour - Income_Tax - Canada_Pension_Plan - Income_Tax_Rate,"."
delay(2000)
cls
var font2 : int
font2 := Font.New ("Times New Roman:20:Bold")
Font.Draw ("Thank you for using our services.", 145, 250, font2, brightgreen) |
|
|
|
|
|
 |
lordroba

|
Posted: Tue Mar 01, 2011 7:00 pm Post subject: Re: New guy just learning |
|
|
Maybe add a Input.Pause before the "Thank you for using our services" line so the user has more than 2 seconds to look at their income. Otherwise, not bad. |
|
|
|
|
 |
Micro
|
Posted: Tue Mar 01, 2011 7:08 pm Post subject: Re: New guy just learning |
|
|
lordroba @ Tue Mar 01, 2011 7:00 pm wrote: Maybe add a Input.Pause before the "Thank you for using our services" line so the user has more than 2 seconds to look at their income. Otherwise, not bad.
I'm not familiar with the Input.Pause command. Would it work the same way if i just increase the delay time be the message appears? |
|
|
|
|
 |
mirhagk
|
Posted: Tue Mar 01, 2011 8:34 pm Post subject: RE:New guy just learning |
|
|
no input.pause waits until the user presses something to continue |
|
|
|
|
 |
RandomLetters
|
Posted: Tue Mar 01, 2011 9:01 pm Post subject: RE:New guy just learning |
|
|
if you're not familiar with Input.Pause you can use what you already know to achieve the same effect, that is, get an input before continuing |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
|
|