0
#include <iostream>
using namespace std;

int main()
{
    //declare variables
    const double FEE = 10.00;
    double total_fee, charges, checks;

    //display header information
    cout << "Chapter 4 Homework\n\n";

    //request input from user
    cout << "Enter number of checks written this month ";
    cin >> checks;
    cout << "\n";


    if (checks = 0 && checks < 20)
       charges = checks * 0.10;
    else if (checks = 20 && checks <=39)
       charges = checks * 0.08;
    else if (checks = 40 && checks <= 59)
       charges = checks * 0.06;
    else if (checks <= 60)
       charges = checks * 0.04;
    else
       cout << "Number of checks must be zero or more.\n\n\n";

    total_fee = FEE + charges;

    cout << "The bank fee this month is $" << total_fee << " for " << checks << " checks\n\n\n";

    system("pause");
    return 0;
}

I have a homework problem (not looking for answer)asking me to create a program that will calculate the fees for a commercial checking account. It states

A bank charges $10 per month plus the following check fees for a commercial cehcking account:

$.10 each for fewer than 20 checks
$.08 each for 20-39 checks
$.06 each for 40-59 checks
$.04 each for 60 or more checks

Write a program that asks for the number of checks written during the past month, then computes and displays the bank's fees for the month.

Input Validation: Do not accept a negative value for the number of checks written.

I do not want the answer but direction to find out what I am doing wrong. I believe it is not keeping the value for the variable checks

Thanks in advance for any assistance.

Edited by nUmbdA

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by nUmbdA
1

remember, = is an asignment operator while == is a condtional check operator.

Edited by A Haunted Army

0

WoW such a simple issue haha. Thank You very much!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.