Browse Source

Implementation of function runBankmanagementSystem(). This function is the starting point of our software. Its job is to call other functions implemented in other c-files. Multiple files are compiled.

remotes/origin/development
fdai7057 2 years ago
parent
commit
5709d437f6
  1. 6
      build-script.sh
  2. 6
      src/CustomerData.txt
  3. 8
      src/createCustomer.c
  4. 1
      src/createCustomer.h
  5. 7
      src/mainMenu.c
  6. 2
      src/mainMenu.h
  7. 13
      src/program.c
  8. 2
      src/stringManipulation.c
  9. 0
      src/stringManipulation.h

6
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 ..

6
src/CustomerData.txt

@ -1,6 +0,0 @@
1234=example
ID=1234
forename=Max
Surname=Mustermann
password=example
balance=0

8
src/createCustomer.c

@ -21,6 +21,7 @@ void collectCustomerProperties()
bool inputTooLong = false; bool inputTooLong = false;
printf("To create a new user, enter the information required below.\n"); printf("To create a new user, enter the information required below.\n");
printf("Enter forename (max. 15 letters):\n"); printf("Enter forename (max. 15 letters):\n");
userInput = getchar();
while(letterCounter<letterMaximum && (userInput=getchar())!='\n'){ while(letterCounter<letterMaximum && (userInput=getchar())!='\n'){
*(instance.forename+letterCounter) = userInput; *(instance.forename+letterCounter) = userInput;
++letterCounter; ++letterCounter;
@ -79,11 +80,8 @@ void writeCustomerPropertiesToFile(customer_t *referenceToCustomerInstance)
{ {
FILE *customerData = fopen("CustomerData.txt","a"); FILE *customerData = fopen("CustomerData.txt","a");
if(customerData!=NULL){ if(customerData!=NULL){
/*calling generateCheckString() at this place in future*/
fprintf(customerData,"ID=%d\nForename=%s\nSurname=%s\nPassword=%s\nBalance=%.4f€\n\n",
referenceToCustomerInstance->ID,referenceToCustomerInstance->forename,
referenceToCustomerInstance->surname,referenceToCustomerInstance->password,
referenceToCustomerInstance->balance);
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); fclose(customerData);
} }
else{ else{

1
src/createCustomer.h

@ -3,6 +3,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <time.h> #include <time.h>
#include "customerProperties.h" #include "customerProperties.h"
#include "stringManipulation.h"
int generateID(); int generateID();
void collectCustomerProperties(); void collectCustomerProperties();
void writeCustomerPropertiesToFile(customer_t *); void writeCustomerPropertiesToFile(customer_t *);

7
src/mainMenu.c

@ -55,7 +55,7 @@ void ageInput()
menuInput(); menuInput();
menuInput();
//menuInput();
break; break;
@ -99,15 +99,14 @@ void menuInput()
selection = strtol(choiceInput, &choiceInputPointer, 10); selection = strtol(choiceInput, &choiceInputPointer, 10);
} }
switch(selection) switch(selection)
{ {
case 1 : printf("\nLoginAsCostumer() function will be implemented here soon\n\n"); case 1 : printf("\nLoginAsCostumer() function will be implemented here soon\n\n");
break; break;
case 2 : printf("\ncreateCostumerAccount() function will be implemented here soon\n\n");
case 2 :
collectCustomerProperties();
break; break;
case 3 : printf("\nLoginAsEmployee() function will be implemented here soon\n\n"); case 3 : printf("\nLoginAsEmployee() function will be implemented here soon\n\n");
break; break;

2
src/mainMenu.h

@ -6,6 +6,8 @@
#include<stdbool.h> #include<stdbool.h>
#include<string.h> #include<string.h>
#include "createCustomer.h"
bool agePermission(int age); bool agePermission(int age);
bool checkIfInteger(char* userInput); bool checkIfInteger(char* userInput);
bool chooseOption(int choiceInput); bool chooseOption(int choiceInput);

13
src/program.c

@ -0,0 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
#include "mainMenu.h"
void runBankManagementSystem()
{
ageInput();
}
int main()
{
runBankManagementSystem();
}

2
src/StringManipulation.c → src/stringManipulation.c

@ -1,4 +1,4 @@
#include "StringManipulation.h"
#include "stringManipulation.h"
/*Code written by Julius Philipp Engel, fdai7057*/ /*Code written by Julius Philipp Engel, fdai7057*/
char *stringConcatenation(char *string_1, char *string_2) char *stringConcatenation(char *string_1, char *string_2)

0
src/StringManipulation.h → src/stringManipulation.h

Loading…
Cancel
Save