Credit Card Program

My professor wants us to write a program that computes and outputs the penalty on an unpaid credit card balance. The program prompts the user to enter payment and ceditCardBalance. The program assumes that the interest rate on the unpaid balance is 2%. The penalty must be calculated in the function.
but I don't even know where to start. Pleasee Help ?
start with:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using namespace std;

int main() {
    float pay = 0;
    cout << "Enter your payment: ";
    cin >> pay;
    
    // call a function
    cout << "You entered " << pay << endl;

    return 0;
}
Okay , but how will I calculate the penalty in the function?
With math.
penalty = balance + balance * 0.02

create a function that takes a balance as input and returns the penalty by using this formula
Topic archived. No new replies allowed.