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

153: Write a program to read an amount (integer value) and break the amount into smallest possible number of bank notes. Note: The possible banknotes are 500, 100, 50, 20, 10, 5, 2, and 1

206: Write a program to create a class named "Circle" which has the property "radius". Define functions to calculate the area and circumference of the circle.

221: // In Task 2, we discussed multilevel inheritance with parameterized constructors for Student, UndergraduateStudent, and GraduateStudent classes in a university management system. Can you explain the advantages of using multilevel inheritance with specific details about the functions and data members in these classes? How were the parameterized constructors (e.g., setting student name, age, and ID) used to ensure that each class in the hierarchy correctly initializes its properties, such as creating an UndergraduateStudent named "John," aged 20, with a student ID of 12345