diff --git a/src/sendmoney.c b/src/sendmoney.c index 7056895..021830f 100644 --- a/src/sendmoney.c +++ b/src/sendmoney.c @@ -49,3 +49,49 @@ void getReceiverAccountNumber() printf("KontoNummer Gültig"); } } + +// Methode send() +void SendMoney() +{ + + float amountToSend; + double balance = 1000; + printf("Bitte geben Sie the Amount:"); + scanf("%e", &amountToSend); + float amount = getAmount(amountToSend); + int receiverAccountNumber; + float availableAccountBalance = getAvailableAccountBalance(balance); + + char tryDifferentAmount; + + if (amountToSend < 0) + { + printf("Bitte geben Sie einen Gültigen Amount"); + } + + else + { + + if (amountToSend <= availableAccountBalance) + { + + getReceiverAccountNumber(); + } + else + { + printf("You don't have a sufficient money to transfer\n"); + printf("try with a different amount? [y]: Yes, any Other key: exit:"); + + scanf("%s", &tryDifferentAmount); + + if (tryDifferentAmount == 'Y' || tryDifferentAmount == 'y') + { + amount = getAmount(amountToSend); + } + else + { + printf("Fehler"); + } + } + } +}