Question
C Programming For your lab, you will write a small utility to determine whether a store customer has exceeded the credit limit on their account.
C Programming
For your lab, you will write a small utility to determine whether a store customer has exceeded the credit limit on their account. To accomplish this, your program will accept as input five values, listed below:
- Account Number (an integer value)
- The customers balance at the beginning of the month
- The total of all items charged by the customer this month
- The total of all credits applied to this customers account
- Allowed credit limit
You will need to declare a variable to store each of the above values. The account number is an integer value, but I will leave it to you to determine what data type should be used for the other four (hint: they are all currency amounts, so should support decimal points).
Once you have prompted for and stored the users input into the associated variables, you will need to calculate the customers new balance. This is achieved through the formula (new balance = original balance + charges credits). You may want to declare a new variable to store this total.
Finally, using an if statement, determine if the users new balance has exceeded their credit limit. If it has (and only if it has), print out the users account number, credit limit, and new balance, so that the information may be reviewed. If the user has not exceeded their limit, print out their account number and a message informing the user that they are in good standing. For an idea of how you might format this output, see the sample screenshots below.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started