Need a pseudocode for this problem please! In this portion of the lab you will a
ID: 3856834 • Letter: N
Question
Need a pseudocode for this problem please!
In this portion of the lab you will analyze the problem listed below. You will figure out what the inputs and outputs are as well as develop a problem statement. You will also determine what variables you will use and create some pseudocode.
For this lab you are going to take the program you developed for Lab #4 on compound interest, modularize it and add input validation. Here is the description of the problem:
You are looking to save some money for a new car, home or expensive computer. You have consulted with a local credit union and found out that they compound monthly. This means that every month they take the current balance, calculate the interest on that and then add that interest to the current balance. Therefore, as each month elapses, you earn money on your money. Rather than calculate how much money you will have by the time you want to buy this item, you decide to write a program to do the math for you. Create a program that will ask the user how much money they can afford to save each month. Additionally ask how many months they plan on saving and the annual interest rate. Use the program to determine the amount of interest you will earn each month and the new balance. Output the month number, the amount of interest and the new balance. Once you have calculated the final balance and interest, ask the user if they want to run the program again to calculate a different monthly savings amount, rate and term.
HINT: The program REQUIRES 2 loops. Once nested in the other. Pay attention to your counters and your accumulators. To determine a monthly rate, take the annual rate and divide it by 12. Finally interest is calculated by taking the balance and multiplying it by the monthly interest rate.
Please add input validation to the following inputs:
Continue variable – this variable allows the user to keep running the program.
Savings – this is the value the user enters when asked how much money they have to save each month. Validate this to be a positive float.
Rate – this is the current annual interest rate for the investment. Validate this as a positive float.
Term – this is the number of months. I realize that this could be a float. However to get practice, validate this to be a positive integer.
As the instructions mention above you also need to modularize this assignment. Since this lab will utilize Python as opposed to Raptor, you could create the following functions:
Calculate the monthly balance
Validate the positive floats
Validate the positive integers
Validate the continue variable so it will only accept a value of ‘yes’ or ‘no’.
At a minimum, please create functions for the input validation. (HINT: at least 3 functions)
Step 1: : Open up Notepad or Notepad ++ and enter the following:
Inputs:
Outputs:
Problem Statement:
Remember the problem statement is just a brief summary of what you are trying to do with your code to solve the problem. It should be no more than a sentence or two. Also remember that your inputs and Page 2 of 4
outputs just need to be a listing, such as: at bats, name, etc. As programmers, we define our inputs and outputs in order to start a list of variables we may have to use in the program.
Step 2: While still in Notepad or Notepad++ type in the following:
Variable Name Datatype
Under your headings, start typing in your variables and what you think the datatypes should be. Your choice of datatypes are string, float and integer.
Step 3: While still in Notepad or Notepad++ type in the following:
30,000 foot view
The 30,000 foot view is an outline of what the program needs to do. It should be a bulleted list. For the first couple of labs, you are not going to type in much here because not much is going on.
Step 4: While still in Notepad or Notepad ++ type in the following:
Pseudocode
Explanation / Answer
Pseudocode for the above program:
Hence, this is the pseudocode for the given above program.
Please rate the answer if it helped....Thankyou
Hope it helps......
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.