Hi, I'm learning just general pseudocode in my class this semester. I'm having trouble understanding some of the repetition structures in the book.
The instructions for one particular problem tell me to calculate how much money is earned if the salary is one penny the first day and it doubles each day after that. I'm having trouble writing the statements that will calculate the salary. It also tells me to display the dollar amount, not the number of pennies. I'm not even asking for the answer, just some kind of push in the right direction at least.
Declare Real days, counter, salary, pennies
//Get upper limit
Display "Calculate earnings over how many days?"
Input days
//Display table headers
Display "Day", Tab, "Salary"
Display "------------------"
//Calculate & display salary
For counter = 1 to days
Having trouble with the calculation!!!
Display counter, Tab, salary
End For
I know I need a formula that doubles the amount. Would the amount start with 0.01?
Question
bs819
Hi, I'm learning just general pseudocode in my class this semester. I'm having trouble understanding some of the repetition structures in the book.
The instructions for one particular problem tell me to calculate how much money is earned if the salary is one penny the first day and it doubles each day after that. I'm having trouble writing the statements that will calculate the salary. It also tells me to display the dollar amount, not the number of pennies. I'm not even asking for the answer, just some kind of push in the right direction at least.
I know I need a formula that doubles the amount. Would the amount start with 0.01?
Is that formula close?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts