0

Writing pseudocode for an assignment that asks to convert the number of pennies collected into dollars and cents, BUT displaying on seperate lines. I understand (sort of) that the \ sign will divide and return an integer result of the whole number and discard the fraction, while the Mod % will divide and return only the remainder as an integer and dicard the whole part of the number. However I am stumped as to how to write this exactly and have it display separetly. I understand how to do all the declarations and input, I just really need help on this part. Thanks!

2
Contributors
10
Replies
30
Views
3 Years
Discussion Span
Last Post by Brandy_1
0

This doesn't have anything to do with pseudocode, and doesn't really belong in computer science. It sounds like a problem in a particular language. See, psudocode is basically writting code in english, and there is no defined standard. You seemed to have some very language spesific terms floating around there.

To print something on differen't lines, you just SAY your printing them on different lines in english. There is nothing else to it.

Do you need help creating the formulas for dollars and cents? Show us what you have, and we'll help you fix your formulas.

0

Actually now I have to problems! The one previously discussed, I wrote a pseudocode formula as <Set Dollars to Pennies\100> to discard the fractional part and only show as Dollars, then I was going to do <Set Dollars to Pennies%100> to discard the whole number. Is that right or should i just write one formula and have it print the dollars and cents seperately as you suggested? How would I have them display seperately?

Secondly, I am working on a Raptor program for future value to be compounded quarterly, the formula given is: FutureValue = PresentValue (1+ (Rate/4)^4Years. I am getting an incorrect answer! Grr. I am going to try to take the 4 before years out and see if that somehow makes it work.

Any help you have is greatly appreciated, feel like I may have gotten in over my head with this class!

0

Your arithemetic is correct.

Set Dollars to Pennies\100 is fine.

Set Dollars to Pennies%100 Your overwritting your Dollars! Store Pennies%100 somewhere else!

You display then seperately by saying their on different lines! I don't know how much easier it gets then that. If your still confused then here: Print Dollars on line 1, and print RemeiningPennies on line 2. Or anything to that effect. I don't care. No one reading you psuedocode will care.

I am getting an incorrect answer!

Pardon; incorrect answer? The only possibilities are: (1) You typed it into your calculator wrong, (2) Your calculator is broken, (3) You messed up the calculation by hand.

If your in the market, I personally think the TI-30X IIS is the best out out there (that is generally accepted for University math). Though, most operating systems come with an ok calculator, and most interpreters can be used as a good calculator.

Edited by Hiroshe

0
Thank you for the dollars and pennies advice, getting ready to try it. The Future Value is being used in my Raptor program. It does not work, and the only thing the teacher will tell me is to look at the order of operations! I know it works on my TI-84 Plus, but it will not work out the correct answer in Raptor! 
0

I entered it as I stated above. I know, it should work, but doesn't! FutureValue = PresentValue(1+ Rate/4)^4Years. It will not accept it without the actual multiplication symbols either.

0

This has nothing to do with computer science or pseudocode. This has to do with programming a formula into "raptor", whatever that is. I'm guessing you want to use '*' as the multiplication symbol. Also, I have no idea if it would support '^' either. It might be '**'. It might not even provide a exponentiation.

Try reading the documentation for your tool/language. Generally you can find a tutorial for it somewhere online, or on youtube.

0

RAPTOR is a flowchart-based programming environment, designed specifically to help students visualize their algorithms and avoid syntactic baggage. RAPTOR programs are created visually and executed visually by tracing the execution through the flowchart. Required syntax is kept to a minimum. Students prefer using flowcharts to express their algorithms, and are more successful creating algorithms using RAPTOR than using a traditional language or writing flowcharts without RAPTOR. http://raptor.martincarlisle.com/
This is the chosen way to learn to write code at the school I attend.

0

If your having problems with "raptor" then start a new thread either in "Software Development" or "Legacy Languages" with the name of the environment in the title.

The field of computer science about theory, not about implmentation, so you won't get very many usefull answers here.

0

Okay I will try that, thank you so much for all your help! The pennies/dollar thing worked out fine. Have a great night.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.