Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

Write a program, Pay.txt, to input the number of 8-hour days worked and the pay rate (dollars per hour) and display as output the dollar amount of the paycheck. For example, if the number of days worked is 4 and the pay rate is 10 dollars per hour, then the output should be 320. In this case there should be 3 lines on the screen: 4 and, under that, 10 and, under that, 320. Separate the output from the input with a blank line

OpenStudy (anonymous):

Dominios, where are you having a problem at? Also, please read openstudy's code of conduct. http://openstudy.com/code-of-conduct Now on that note, what is troubling you? It seems you just have posted your assignment. You did not even say what computer language you needed this written in......

OpenStudy (anonymous):

sorry i thought i sent my code too do u know how i can upload it

OpenStudy (anonymous):

You can go to pastebin.com and paste your code there, then give us the link. What language?

OpenStudy (anonymous):

here it is <script src=" http://pastebin.com/embed_js.php?i=ZJciG5BW "></script>

OpenStudy (anonymous):

Oh, umm, assembly code? *backs slowly out the door*

OpenStudy (anonymous):

Ok, if I'm reading this right... mov cx, 8 //This stores 8 in the cx register call getVal ;cx = a (user input) //then you are inputing the number of days into the cx register, which btw will overwrite the value you just stored there. mov M1, AX ;M1 = a // Hmm, moving the value in the ax register into M1. Did you perhaps mean ax in the previous line? Does getVal store the input in the ax register? call getVal ;AX = b (user input) //It would appear it does. Ok, so your comment in line 2 is wrong. mul M1 //Assuming that the mul operator multiplies the values in M1 and the ax register, this just multiplied the rate times the number of days, which will work but may not be what you intended. I'll assume the answer is stored in the ax register. mov M1, AX ;M2 = ab //Move the value in ax to M1. Two things wrong with the comment anyway: M2 is not being used at all and the value is bc not ab. mov BX, M1 ;BX = ab /Stores the value in M1 in the bx register. Ok, except that the value is bc, as noted above. mul M2 ;DX:AX = AX*M2 = c*ab = ab // Uh, no. Whatever is in M2 at this stage is unknown. What you want is the value in the bx register multiplied by the value for the number of hours in a day (8) which you stored in cx in the first step. add BX, AX ;AX = AX + BX = abc + ab //Why are you adding anything? The answer to your algorithm is given by a x b x c, as noted in the example. Also, wouldn't this store the answer in the bx register? Most assembly operators take the form: Opcode destination, source call putVal ;displays contents of AX, which is ab + abc // this should work, if you had the correct value in the ax register. ret include ioSubs.inc I know this question is old but hopefully this helps someone :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!