Starting from:
$35

$29

Computer Programming Homework # 9 Solution

Description: In this homework, you will implement a sequence model for banking system. This homework will be implemented by using Structs in C.

The bank has five type of customer, which are labelled as 0, 1, 2, 3, 4. These labels showed us customer’s job. 0 is employee, 1 is retired, 2 is student, 3 is unemployed and 4 is other.

Each customer’s construct must include Name, Age and Label. These are will be get from user input with using command line. Name, age and label must be keep in struct.

Banking system keeps maximum 50 customer in same time.

Label 0 has the highest priority, then 1, 2, 3, 4 have the lower priorities respectively.

Example : sequence contains 0-0-0-1-2-2-3-4-4-5 and new customer want to join with label 1.

Sequence will be updated like this : 0-0-0-1-1-2-2-3-4-4-5

To prevent starvation when occur 0 labelled customers comes continuously, each type of customer has limitations like this: 0 label customer can join 5 times in a row, 1 label customer can join 3 times in row, 2 label customer can join 3 times in a row, 3 label customer can join 2 times in a row, 4 label customer can join 2 times in a row.

Example : sequence contains 0-0-0-0-1-1-2-3-3-4 , if two customers want to join sequence label 1, the

new sequence will be like this: 0-0-0-0-1-1-1-2-3-3-4-1,

sequence contains 0-0-0-0-1-1-2-3-3-4 , if one customers want to join sequence label 0, the new sequence will be like this: 0-0-0-0-0-1-1-2-3-3-4,

sequence contains 0-0-0-0-1-1-2-3-3-4 , if one customers want to join sequence label 3, the new sequence will be like this: 0-0-0-0-1-1-2-3-3-4-3

Program should appear as follows:

***********Banking System***********

Current Sequence:

1-Add customer

2-Process customer

2
There is not any customer in bank system sequence.

Current Sequence:

1-Add customer

2-Process customer

1

Please enter the name of the customer : Jack

Please enter the age of the customer : 26

Please enter the label of the customer : 2

Current Sequence: 2

1-Add customer

2-Process customer

1

Please enter the name of the customer : Henry

Please enter the age of the customer : 38

Please enter the label of the customer : 3

Current Sequence: 2 - 3

1-Add customer

2-Process customer

    • After some additions Current Sequence: 2-3-4-4 1-Add customer

2-Process customer

2

Proceed customer is Jack Current Sequence: 3-4-4 1-Add customer

2-Process customer

2

Proceed customer is Henry Current Sequence: 4-4 1-Add customer

2-Process customer

    • Continue like these












What to hand in: You are expected to hand in c code file. Your implementations should be completed in “hw9_io.c” and “hw9_lib.c”.

    • HW9_lastname_firstname_studentno.c / HW9_lastname_firstname_studentno.c

More products