Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this lab, you will plan and create an algorithm for the problem specification shown in Figure 8-15. You begin by analyzing the problem, looking

In this lab, you will plan and create an algorithm for the problem specification shown in Figure 8-15. You begin by analyzing the problem, looking first for the output and then for the input. In this case, the program should display a persons total earnings before retirement at age 65, using annual raise rates of 3%, 4%, and 5%. To calculate the amounts, the program will need to know the persons age and current salary. the programming language is c++

Next, you plan the algorithm and then desk-check it. Figure 8-15 shows the completed IPO chart and desk-check table, which (for simplicity) uses an age of 62 and a salary of $25000. The algorithm contains two loops. The outer loop keeps track of the three annual raise rates (3%, 4%, and 5%). The nested loop keeps track of the number of years until retirement.

Problem specification

Create a program that allows the user to enter a persons age (in years) and current salary. Both input items should be entered as integers. The program should display a persons total earnings before retirement at age 65, using annual raise rates of 3%, 4%, and 5%. Display the total earning amounts as integers.

Input Processing Output

age (1-64 years) Processing items: total earnings (at end of

current salary raise rate (3%, 4%, 5%) each of the years until

years until retirement retirement)

new salary

year (counter)

Algorithm:

1. enter the age

2. if (the age is less than 1 or greater than 64)

display reenter message

else

enter current salary

calculate years until retirement = 65 age

repeat for (each raise rate)

assign current salary to new salary

assign current salary to total earnings

repeat for (year 2 to years until retirement)

new salary = new salary * (1 + raise rate)

add new salary to total earnings

end repeat

display raise rate and total earnings

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions