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. 10
      src/createCustomer.c
  4. 1
      src/createCustomer.h
  5. 9
      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

10
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(letterCounter<letterMaximum && (userInput=getchar())!='\n'){
*(instance.forename+letterCounter) = userInput;
++letterCounter;
@ -79,12 +80,9 @@ void writeCustomerPropertiesToFile(customer_t *referenceToCustomerInstance)
{
FILE *customerData = fopen("CustomerData.txt","a");
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);
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");

1
src/createCustomer.h

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

9
src/mainMenu.c

@ -55,7 +55,7 @@ void ageInput()
menuInput();
menuInput();
//menuInput();
break;
@ -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;

2
src/mainMenu.h

@ -6,6 +6,8 @@
#include<stdbool.h>
#include<string.h>
#include "createCustomer.h"
bool agePermission(int age);
bool checkIfInteger(char* userInput);
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*/
char *stringConcatenation(char *string_1, char *string_2)

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

Loading…
Cancel
Save