diff --git a/build-script.sh b/build-script.sh new file mode 100755 index 0000000..0f1eb09 --- /dev/null +++ b/build-script.sh @@ -0,0 +1,6 @@ +clear +cd src/ +gcc stringManipulation.c createCustomer.c mainMenu.c program.c -o program.out +./program.out +rm program.out +cd .. diff --git a/src/CustomerData.txt b/src/CustomerData.txt deleted file mode 100644 index 3ac070f..0000000 --- a/src/CustomerData.txt +++ /dev/null @@ -1,6 +0,0 @@ -1234=example -ID=1234 -forename=Max -Surname=Mustermann -password=example -balance=0 diff --git a/src/createCustomer.c b/src/createCustomer.c index dbc78d6..58ee01d 100644 --- a/src/createCustomer.c +++ b/src/createCustomer.c @@ -21,6 +21,7 @@ void collectCustomerProperties() bool inputTooLong = false; printf("To create a new user, enter the information required below.\n"); printf("Enter forename (max. 15 letters):\n"); + userInput = getchar(); while(letterCounterID,referenceToCustomerInstance->forename, - referenceToCustomerInstance->surname,referenceToCustomerInstance->password, - referenceToCustomerInstance->balance); - fclose(customerData); +fprintf(customerData,"%s\nID=%d\nForename=%s\nSurname=%s\nPassword=%s\nBalance=%.4f€\n\n", +generateCheckString(referenceToCustomerInstance->ID, referenceToCustomerInstance->password),referenceToCustomerInstance->ID,referenceToCustomerInstance->forename,referenceToCustomerInstance->surname,referenceToCustomerInstance->password, referenceToCustomerInstance->balance); + fclose(customerData); } else{ printf("Error when accessing the file.\n"); diff --git a/src/createCustomer.h b/src/createCustomer.h index bd58756..82eeee8 100644 --- a/src/createCustomer.h +++ b/src/createCustomer.h @@ -3,6 +3,7 @@ #include #include #include "customerProperties.h" +#include "stringManipulation.h" int generateID(); void collectCustomerProperties(); void writeCustomerPropertiesToFile(customer_t *); diff --git a/src/mainMenu.c b/src/mainMenu.c index 78611ea..0bed352 100644 --- a/src/mainMenu.c +++ b/src/mainMenu.c @@ -55,7 +55,7 @@ void ageInput() menuInput(); - menuInput(); + //menuInput(); break; @@ -90,7 +90,7 @@ void menuInput() scanf("%s", choiceInput); selection = strtol(choiceInput, &choiceInputPointer, 10); - + while (!checkIfInteger(choiceInput) || !chooseOption(selection)) { printf("Input invalid! try again!\n"); @@ -99,15 +99,14 @@ void menuInput() selection = strtol(choiceInput, &choiceInputPointer, 10); } - switch(selection) { case 1 : printf("\nLoginAsCostumer() function will be implemented here soon\n\n"); break; - case 2 : printf("\ncreateCostumerAccount() function will be implemented here soon\n\n"); - break; - + case 2 : + collectCustomerProperties(); + break; case 3 : printf("\nLoginAsEmployee() function will be implemented here soon\n\n"); break; diff --git a/src/mainMenu.h b/src/mainMenu.h index 4907629..0891487 100644 --- a/src/mainMenu.h +++ b/src/mainMenu.h @@ -6,6 +6,8 @@ #include #include +#include "createCustomer.h" + bool agePermission(int age); bool checkIfInteger(char* userInput); bool chooseOption(int choiceInput); diff --git a/src/program.c b/src/program.c new file mode 100644 index 0000000..3aa7390 --- /dev/null +++ b/src/program.c @@ -0,0 +1,13 @@ +#include +#include +#include "mainMenu.h" + +void runBankManagementSystem() +{ + ageInput(); +} + +int main() +{ + runBankManagementSystem(); +} diff --git a/src/StringManipulation.c b/src/stringManipulation.c similarity index 97% rename from src/StringManipulation.c rename to src/stringManipulation.c index 7ac306e..8ac683a 100644 --- a/src/StringManipulation.c +++ b/src/stringManipulation.c @@ -1,4 +1,4 @@ -#include "StringManipulation.h" +#include "stringManipulation.h" /*Code written by Julius Philipp Engel, fdai7057*/ char *stringConcatenation(char *string_1, char *string_2) diff --git a/src/StringManipulation.h b/src/stringManipulation.h similarity index 100% rename from src/StringManipulation.h rename to src/stringManipulation.h