Browse Source

Hotfix: resolve file name problem (1/2)

GitLab won't detect the difference between sendMoney.c and sendmoney.c. In order to fix it fast, this commit will remove the files, and then add new ones in the next push.
remotes/origin/feature/balance-operations
fdlt3817 2 years ago
parent
commit
4fb75efbbc
  1. 121
      src/sendmoney.c
  2. 14
      src/sendmoney.h

121
src/sendmoney.c

@ -1,121 +0,0 @@
#include "sendMoney.h"
#include "depositMoney.c"
#include "withdrawMoney.c"
#include "currencyExchange.c"
void showBalance(int customerID){
float balance=getAvailableAccountBalance(customerID);
printf("\n:.:.:.:.:.:");
printf("\nYour current balance is %.2f.\n",balance);
printf(":.:.:.:.:.:\n");
}
float askToConvert(float input, int customerID){
char c;
char symbol[]="";
int id;
float converted;
printf("\nWould you like to convert the amount from € to another currency?[y] yes [any] no\n");
scanf(" %c",&c);
if(c=='y'||c=='Y'){
printf("\nPlease select from one of the following currencties to convert to:");
printf("\n[1] USD");
printf("\n[2] GBP");
printf("\n[3] YEN");
printf("\n[4] YUAN\n");
scanf("%d",&id);
if(id>0&&id<5){
converted=convert(input,id);
}else{
return 0;
}
switch(id){
case 1:
symbol[0]='$';
break;
case 2:
symbol[0]='P';
break;
case 3:
symbol[0]='Y';
break;
case 4:
symbol[0]='X';
break;
}
printf("\nYou have successfuly transfered %.2f%s to [%d]",converted, symbol,customerID);
return converted;
}else{
return 0;
}
}
void askToShowBalance(int customerID){
char c;
printf("\nWould you like to see your remaining balance? [y] yes [any] no\n");
scanf(" %c",&c);
if(c=='y' || c=='Y'){
showBalance(customerID);
}
return;
}
bool sendMoney(int customerID){
float availableAccountBalance=getAvailableAccountBalance(customerID);
float amountToSend;
int recID;
showBalance(customerID);
printf("\nHow much would you like to send?\n");
scanf("%f",&amountToSend);
if(amountToSend>0 && amountToSend<availableAccountBalance){
printf("\nYour input was %.2f€. Please enter the recipient id.\n",amountToSend);
scanf("%d",&recID);
if(recID>1000){
bool recExists=checkCustomerExists(recID);
if(recExists){
if(recID==customerID){
printf("\nYou cannot send money to yourself. Aborting. \n");
return false;
}
else{
if(withdrawSpecificAmount(customerID, amountToSend)){
if(depositSpecificAmount(recID, amountToSend)){
askToConvert(amountToSend, recID);
//printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID);
askToShowBalance(customerID);
return true;
}
else{
printf("\nSomething went wrong with the transfer. Please contact staff.");
}
}
}
}else{
printf("\nThis ID is not from a customer of our bank. A transfer fee of %.2f€ will be taken.\n", TRANSFER_FEE);
if(withdrawSpecificAmount(customerID, amountToSend+TRANSFER_FEE)){
askToConvert(amountToSend, recID);
//printf("\nYou have successfuly transfered %.2f€ to [%d]\n",amountToSend,recID);
askToShowBalance(customerID);
return true;
}
}
}
else
{
printf("\nThe ID you have entered is not valid. Aborting. \n");
}
}else{
//error
return false;
}
return false;
}
// int main(){
// sendMoney(1234);
// return 0;
// }

14
src/sendmoney.h

@ -1,14 +0,0 @@
#ifndef SENDMONEY_H
#define SENDMONEY_H
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#define TRANSFER_FEE 0.8
void showBalance(int customerID);
float askToConvert(float input, int customerID);
void askToShowBalance(int customerID);
bool sendMoney(int customerID);
#endif // SENDMONEY_H
Loading…
Cancel
Save