From b98932b1971776753252c6dc325a03a827a297eb Mon Sep 17 00:00:00 2001 From: fdai6618 <74294567+fdai6618@users.noreply.github.com> Date: Sat, 4 Feb 2023 11:51:19 +0100 Subject: [PATCH] implement sendMoney methode --- src/sendmoney.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) 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"); + } + } + } +}