Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.46 KB | None | 0 0
  1. // Cody Scott
  2. // Assignment #2
  3. // Question #4
  4. // This program will prompt the user for an account number, account type, minimum balance and current balance
  5. // and return feedback for the end of the month based on input
  6.  
  7. #include <stdio.h>
  8.  
  9. int main () {
  10.     int accountNumber, minBalance, currentBalance;
  11.     char accountType, temp; // temp variable used to store enter character for submission of scanf
  12.     printf ("Enter Account Number: ");
  13.     scanf ("%d%c", &accountNumber, &temp);
  14.     printf ("Enter accoutn type\nS for Savings\nC for Chequing\n");
  15.     scanf ("%c%c", &accountType, &temp);
  16.     printf ("Enter minimum balance: ");
  17.     scanf ("%d%c", &minBalance, &temp);
  18.     printf("Enter current balance: ");
  19.     scanf ("%d%c", &currentBalance, &temp);
  20.     printf("Account Number:\n%d\nAccount Type:\n%c\nCurrent Balance:\n%d\n", accountNumber, accountType, currentBalance);
  21.     //Displays the appropriate message
  22.     if (accountType == 's' || accountType == 'S' && currentBalance > minBalance)
  23.         printf ("You will recieve 4%% interest.");
  24.     else if (accountType == 's' || accountType == 'S')
  25.         printf ("You will be charged $10.00");
  26.     else if (accountType == 'c' || accountType == 'C' && currentBalance > (minBalance + 5000))
  27.         printf ("You will recieve 3%% interest.");
  28.     else if (accountType =='c' || accountType == 'C' && currentBalance < minBalance)
  29.         printf ("You will be charged $25.00");
  30.     else if (accountType == 'c' || accountType == 'C')
  31.         printf ("You will recieve 5%% interest");
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement