Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Cody Scott
- // Assignment #2
- // Question #4
- // This program will prompt the user for an account number, account type, minimum balance and current balance
- // and return feedback for the end of the month based on input
- #include <stdio.h>
- int main () {
- int accountNumber, minBalance, currentBalance;
- char accountType, temp; // temp variable used to store enter character for submission of scanf
- printf ("Enter Account Number: ");
- scanf ("%d%c", &accountNumber, &temp);
- printf ("Enter accoutn type\nS for Savings\nC for Chequing\n");
- scanf ("%c%c", &accountType, &temp);
- printf ("Enter minimum balance: ");
- scanf ("%d%c", &minBalance, &temp);
- printf("Enter current balance: ");
- scanf ("%d%c", ¤tBalance, &temp);
- printf("Account Number:\n%d\nAccount Type:\n%c\nCurrent Balance:\n%d\n", accountNumber, accountType, currentBalance);
- //Displays the appropriate message
- if (accountType == 's' || accountType == 'S' && currentBalance > minBalance)
- printf ("You will recieve 4%% interest.");
- else if (accountType == 's' || accountType == 'S')
- printf ("You will be charged $10.00");
- else if (accountType == 'c' || accountType == 'C' && currentBalance > (minBalance + 5000))
- printf ("You will recieve 3%% interest.");
- else if (accountType =='c' || accountType == 'C' && currentBalance < minBalance)
- printf ("You will be charged $25.00");
- else if (accountType == 'c' || accountType == 'C')
- printf ("You will recieve 5%% interest");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement