Question

1) Write a program with a loop that lets the user enters a series of integers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered.

2) Write a program that calculates the balance of a savings account at the end of a period of time. It
should ask the user for the annual interest rate, the starting balance, and the number of months that have passed since the account was established. A loop should then iterate once for every month, performing the following:
A) Ask the user the amount deposited into the account during the month. (Do not accept negative numbers.). This amount should be added to the balance.
B) Ask the user for the amount withdrawn from the account during the month. (Do not accept negative numbers.). This amount should be subtracted from the balance.
C) Calculate the monthly interest. The monthly interest rate is the annual interest rate divided by twelve. Multiply the monthly interest rate by the balance, and add the result to the balance.
After the last iteration, the program should display the ending balance, the total amount of deposits, the total amount of withdrawals, and the total interest earned.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

1. #include <iostream>

int main(int argc, const char * argv[]) {
    // insert code here...
    bool input = true;
    int integer;
    int min;
    int max;
    while(input)
    {
       std::cout << "Please enter in an integer\n";
       std::cin >> integer;
       if (integer < 0)
       {
            if (integer == -99)
                input = !input;
            continue; //remove this continue if you want to support negative numbers
       }
       if(min == NULL || min > integer)
       {...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Get help from a qualified tutor
Live Chats