Computer Science Canada Have a 9 digit Integer(s displayed as the seperate numbers. |
Author: | bobbyguoguo [ Mon Dec 04, 2006 1:27 pm ] |
Post subject: | Have a 9 digit Integer(s displayed as the seperate numbers. |
My program: const endaster := 60 var name : string var sinn : int var hours, wages, grosspay, deduction, netpay : real put repeat ("*", endaster) for rows : 3 .. 17 put "*" locate (rows, endaster) put "*" end for locate (17, 1) put repeat ("*", endaster) locate (4, 6) put "NAME" locate (5, 6) put "___________" locate (4, 40) put "SIN" locate (5, 40) put "___ ___ ___" locate (7, 6) put "Hours Worked" locate (8, 6) put "_______" locate (7, 40) put "Hourly Wage" locate (8, 40) put "$_______" locate (10, 6) put "Gross Pay Deduction Net Pay" locate (11, 6) put "$_______ $_______ $________" locate (4, endaster) put "*" locate (5, endaster) put "*" locate (7, endaster) put "*" locate (8, endaster) put "*" locate (10, endaster) put "*" locate (11, endaster) put "*" locate (16, 43) put "Copyright 2006" locate (16, endaster) put "*" locate (5, 6) get name locate (5, 40) get sinn locate (8, 6) get hours locate (8, 41) get wages grosspay := hours * wages deduction := grosspay * .20 netpay := grosspay * .80 locate (11, 6) %keep 2 decimal put round(grosspay*100)/100 locate (11, 22) put round(deduction*100)/100 locate (11, 40) put round(netpay*100)/100 locate (11, endaster) put "*" I need to make the SIN number only able to accept 9 digit numbers. Have a 9 digit Integer displayed as the seperate numbers. Examples 410102710 ==> 410 102 710 then check that the first, fourth, and seventh digits add to 12. Thanks!! |
Author: | bobbyguoguo [ Mon Dec 04, 2006 1:27 pm ] |
Post subject: | |
Sry about the previous post, I didn't see the announcement |
Author: | Clayton [ Mon Dec 04, 2006 3:57 pm ] |
Post subject: | |
That doesn't mean you should make a seperate topic at the top (not to mention you double posted for a second time) Anywho, make your number a string, then add the digits together after converting each seperate digit apart from the string. Check out Cervantes' String Manipulation tutorial in the Turing Walkthrough for help. |
Author: | Cervantes [ Mon Dec 04, 2006 10:55 pm ] |
Post subject: | |
Quoting the meaningful response from your other thread: bobbyguoguo wrote: Use the mod, div method
Deleting other thread. Damn, I need thread merging. Please, if you screw up (like make a topic with title "HELP!"), don't make the situation worse by making a second, duplicate topic. |
Author: | TokenHerbz [ Tue Dec 05, 2006 1:08 am ] |
Post subject: | |
hehehe... If only i had powers to change the thread titles! |