152: A bank in your town updates its customers' accounts at the end of each month. The bank offers two types of accounts: savings and checking. Every customer must maintain a minimum balance. If a customer's balance falls below the minimum balance, there is a service charge of $10.00 for savings accounts and $25.00 for checking accounts. If the balance at the end of the month is at least the minimum balance, the account receives interest as follows: a. Savings accounts receive 4% interest. b. Checking accounts with balances of up to $5,000 more than the minimum balance receive 3% // interest; otherwise, the interest is 5%. Write a program that reads a customer's account number (int type), account type (char; s for savings, c for checking), minimum balance that the account should maintain, and current balance. The program should then output the account number, account type, current balance, and an appropriate message. Test your program by running it five times, using the following data: // 46728 S 1000 2700 // 87324 C 1500 7689 // 79873 S 1000 800 // 89832 C 2000 3000 // 98322 C 1000 750

 

// A bank in your town updates its customers' accounts at the end of each month. The bank offers
// two types of accounts: savings and checking. Every customer must maintain a minimum balance. If
// a customer's balance falls below the minimum balance, there is a service charge of $10.00 for
// savings accounts and $25.00 for checking accounts. If the balance at the end of the month is at least
// the minimum balance, the account receives interest as follows:

// a. Savings accounts receive 4% interest.
// b. Checking accounts with balances of up to $5,000 more than the minimum balance receive 3%
// interest; otherwise, the interest is 5%.
// Write a program that reads a customer's account number (int type), account type (char; s for
// savings, c for checking), minimum balance that the account should maintain, and current balance.
// The  program  should  then  output  the  account  number,  account  type,  current  balance,  and  an
// appropriate message. Test your program by running it five times, using the following data:
// 46728 S 1000 2700
// 87324 C 1500 7689
// 79873 S 1000 800
// 89832 C 2000 3000
// 98322 C 1000 750

#include <iostream>
using namespace std;
int main()
{
    float minimum_balance, current_balance;
    int account_number;
    char account_type;

    cout << "___________________________________\n";
    cout << "| Enter your account number: ";
    cin >> account_number;
    cout << "|**********************************\n";
    cout << "|\n| Choose account type\n| c for checking\n| s for saving\n| Enter your choice: ";
    cin >> account_type;
    cout << "|**********************************\n";
    cout << "|\n| Enter minimum balance to maintain in account: $";
    cin >> minimum_balance;
    cout << "|*****************************************************\n";
    cout << "|\n| Enter your current balance: $";
    cin >> current_balance;
    cout << "************************************\n";
   
    cout << "\nAccount number: " << account_number << endl;
    cout << "Account Type: " << account_type << endl;

    if (account_type == 's' || account_type == 'S')
    {
        if (current_balance < minimum_balance)
        {
            current_balance -= 10;
            current_balance += (current_balance * 0.04);
            cout << "Current balance: $" << current_balance << endl;
            cout << "You have been charged $10.00 as service charges\nYou have been given interest 4%" << endl;
        }
        else
        {
            current_balance += (current_balance * 0.04);
            cout << "Current balance: $" << current_balance << endl;
            cout << "You have been given interest 4%" << endl;
        }
    }
    else if (account_type == 'c' || account_type == 'C')
    {
        if (current_balance < minimum_balance)
        {
            current_balance -= 25;
            current_balance += (current_balance * 0.03);
            cout << "Current balance: $" << current_balance << endl;
            cout << "You have been charged $25.00 as service charges\nYou have been given interest 3%" << endl;
        }
        else
        {
            if (current_balance >= (minimum_balance + 5000))
            {
                current_balance += (current_balance * 0.05);
                cout << "Current balance: $" << current_balance << endl;
                cout << "You have been given interest 5%" << endl;
            }
            else
            {
                current_balance += (current_balance * 0.03);
                cout << "Current balance: $" << current_balance << endl;
                cout << "You have been given interest 3%" << endl;
            }
        }
    }
    else
    {
        cout << "Invalid account type" << endl;
    }

    return 0;
}


Comments

Popular posts from this blog

215: Create a C++ program that uses single inheritance to model a simple shape hierarchy. Implement a base class "Shape" with a virtual function "printArea." Derive classes "Rectangle" and "Triangle" from "Shape" and override the "printArea" function to calculate and display their respective areas.

42: ***(Syntax)*** Calculating number of characters and spaces in a string 1- Make a program to calculate the number of characters in a string 2- Modify this and also tell how many spaces are there in that sentence

212: Build a class representing a university student with private data members for name, ID, and a static data member for the total number of students. Implement getter and setter functions for name and ID, and a static getter function to retrieve the total number of students. Use default constructors