Question

In: Computer Science

- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...

- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes.

What does this do? Desk Checking #1:  Explain the intent of this pseudocode. List the data you use as the example data.

start

                  Declarations

         num balance

Use this textbox to explain the pseudocode/ code intent. Include any test data used:

         num month

         num loanAmt

         num paymentAmt

         string PROMPT = “Enter the loan amount and payment amount >> ”

housekeeping()

detail()

finishUp()

stop

housekeeping()

         output PROMPT

         input loanAmt, paymentAmt

return

detail()

                  month = 1

                  balance = loanAmt

                  while balance > 0

                           balance = balance – paymentAmt

                           output month, balance

                           month = month + 1

                  endwhile

return

finishUp()

         output “End of program”

return

Solutions

Expert Solution

I have devised a line-by-line approach to try and explain the code better.

1. our program starts

2. we declare a variable balance which will store a number.

3. we declare a variable month which will store a number.

4.we declare a variable loanAmt which will store a number.

5.we declare a variable paymentAmt which will store a number.

6.we declare a variable PROMPT which will store a string. The string is specifeid to us in our program.

This ends the decleration.

After this we have 3 seperate programs each having a specific task

7. call housekeeping()

the work of housekeeping function is to take 2 values as input, the loanAmt and what the user is going to pay every month or the paymentAmt.

So here we do that. we print the PROMPT to ask the user to input 2 variables.

We then take these 2 variables as input.

Next is detail(): The work of detail is to calculate the number of months required to complete the payment of loan.

So we store the loanAmt in balance, we do this so that the loanAmt is not lost. Suppose we dont perform this step, what would happen is at the end of this function our loanAmt will be less than 0 and now we dont know what our real loanAmt was. So as to not lose that value we use a temporary variable balance.

so while balance>0

we keep deducting the paymentAmt, print the number of months that have passed and the balance amount left .

We increase the number of months after every loop.

Finally, we call the finishup() function:

This function just prints out End of program.

Test data: Dry run

Enter the loan amount and payment amount >> 10000 2000

month=1, balance=10000

balance>0? Yes

balance=8000

Prints: 1 8000

now month=2

Again balance>0 yes

balance=6000

2, 6000

month=3

Again balance>0 yes

balance=4000

3, 4000

month=4

Again balance>0 yes

balance=2000

4, 2000

month=5

Again balance>0 yes

balance=0

5, 0

month=6

Again balance>0? No

so we exit

End of program

If you have any doubts or require any clarifications, let me know in the comment section and i will help you out. If you want me to code this, let me know in the comments. Thank you :)


Related Solutions

- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes. Use this textbox to explain the pseudocode/ code intent. Include any test data used: What does this do? Desk Checking #4:  Explain the intent of this code.  Be as specific as possible.   List the data you use for example...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes. What does this do? Desk Checking #2:  Explain the intent of this pseudocode.  Be as specific as possible. List the data you use as the example data. Use this textbox to explain the pseudocode/ code intent. Include any test...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes What does this do? Desk Checking #3:  Explain the intent of this pseudocode.  Be as specific as possible.   List the data you use for example data. Use this textbox to explain the pseudocode/ code intent. Include any test data...
Show your results all planning tools (algorithm, IPO chart, desk checking, pseudocode, flowchart) for an application...
Show your results all planning tools (algorithm, IPO chart, desk checking, pseudocode, flowchart) for an application that allows a user to enter the price of an item and computes 6.25 percent sales tax on the item.
Show your results using all planning tools (algorithm, IPO chart, desk checking, pseudocode, flowchart) for an...
Show your results using all planning tools (algorithm, IPO chart, desk checking, pseudocode, flowchart) for an application that allows a user to enter the number of text messages he or she sent last month and then displays the bill. Messages cost 25 cents each, and 8 percent tax is charged on the total.
Write program logic or pseudocode to create 3 small programs that do the following: The first...
Write program logic or pseudocode to create 3 small programs that do the following: The first should compute the sum of 2 given integers. The second should multiply the 2 integers. The third should triple the sum of the 2 integers.
4. PROPOSED SOLUTION (PSEUDOCODE) • Start. • Initialize the clear cycle=1 and part[2],generated=0. • Declare the...
4. PROPOSED SOLUTION (PSEUDOCODE) • Start. • Initialize the clear cycle=1 and part[2],generated=0. • Declare the parts of the car as ‘engine’, ‘chassis’, ‘ss’. • Initialize the semaphore sem t ready. • Assign the ids from 0 to 3. • Declare the function void * gen branch(void*arg) which generates the assembly branch. • In the above function declare i,j,k=0 . • Repeat the step 7 until while(1). • Declare sleep(1) so that when the loop runs the next time it...
- Part 1 – 4 Debugging Exercises – there are things wrong – either logic or...
- Part 1 – 4 Debugging Exercises – there are things wrong – either logic or syntax errors.  Correct the pseudocode and one Java program. Add the corrected code in BOLD and change the corrected color to RED.   Debugging 2:  Add the missing code in bold and red. start                   Declarations                            num number                             housekeeping()                   while number >= 15                            detailLoop()                   endwhile                             finish()     stop housekeeping()          number = 1 return detailLoop()          output number          num = number + 1 return finishUp()          output “End of program”...
In the same file, complete the following exercises in the author’s pseudocode as presented in the...
In the same file, complete the following exercises in the author’s pseudocode as presented in the text book and material on Blackboard in this chapter, and following all requirements for good program design that were shown in Chapter 2 and all examples since then. At the Summer Olympic Games every four years, for historical reasons, athletes represent National Olympic Committees (NOCs) rather than strictly countries. For the sake of convenience in our program, let us refer to them simply as...
what is inspection, walkthrough and Desk checking testing my course is analysis and design and it's...
what is inspection, walkthrough and Desk checking testing my course is analysis and design and it's not shows in the subject so i choose operation management just to complete the process !!!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT