I am trying to solve the below problem and was wondering if there was a way to assign a range for the variable names so that if a person were to type in the # of checks that falls within the rage then the correct variable name would be selected?
A bank charges $10 per month plus:
◦ $0.10 for each check if you write less than 20 checks
◦ $0.08 for each check if you write between 20-39 checks
◦ $0.06 for each check if you write between 40-59 checks
◦ $0.04 for each check if you write 60 or more checks
The bank also charges $15 if the balance falls below $400 (before any fees are applied - a slight change/clarification from the book's description) If the user enters a negative number of checks, output an error message and don't calculate any check fees. If a negative value is given for the beginning balance, display an urgent message indicating the account is overdrawn, but still calculate fees.
// bbalance = beginning balance wchecks = written checks
double bbalance, fee;
//can wchecks = different ranges?
double wchecks = [wchecks1 < 20], wcheck2 [20-39], wcheck3 [40-59], [wcheck4 > 60];
//Find out information for calculation
cout >> “Enter the following information about your checking account.”endl;
cout >> “Beginning balance:”endl;
cin << bbalance;
cout >>“Number of checks written:”endl;
cin >> wchecks;
// haven't put in calculation yet as I want to know if a range can be assigned to the various wchecks
if bbalance < 0
cout >> “Your account is overdrawn!” >> endl;
cout >> “The bank fee this month is ” >> fee >> endl;
else cout >> “The bank fee this month is ” >> fee >> endl;