Assignment v5.0 EN
Assignment v5.0 EN
ASSIGNMENT
JOB FAIR
ASSIGNMENT SPECIFICATIONS
Version 5.0 (Updated 10/11/2024)
1 Output Standards
Upon completing this project, students will review and become proficient in using:
2 Introduction
The Job Fair is an event that connects students with companies through various booths, en-
abling companies to introduce job positions while students and applicants can participate if they
feel suited. This is also an opportunity for students to explore real demands in the recruitment
market.
Furthermore, when registering, companies also need to know the current number of avail-
able booths and the list of vacant booths.
Each company registering must have a full name and an abbreviation. In this exercise, we
define each company’s abbreviation as the initial letter of each word in the company’s name.
The booths are arranged into two rows facing each other. In this project, each row will
have 15 booths.
In this project, we will develop the core features of an application to assist the organizing
committee in managing booths and organizing the event.
3 Application Requirements
Booth Status Array: This is a two-dimensional integer array, with each dimension containing
15 elements. The index of each booth in the first row ranges from 0 to 14. For the second row,
the booth index is calculated by adding 15 to the first row index, so it starts at 15 and increases
incrementally (the first booth is 15, the second booth is 16, etc.). The booth status includes:
• Vacant booth: 0
• Registered booth: 1
In this exercise, to simplify the layout and booth status diagram, this array is stored sep-
arately from the booth status array. Therefore, when performing data modifications, students
need to update both arrays to ensure data synchronization. At a minimum, achieving 50% of
the exercise score requires students to update at least the booth status array, disregarding the
enterprise array.
As described above, each enterprise requires an abbreviation. The abbreviation for an enterprise
is defined as the initial letters of each word in the enterprise’s name. Below is an example:
For this exercise, assume that the input data will not contain enterprises with duplicate
abbreviations.
Since the application operates via the command line, the program needs to determine the type
of command issued in order to call the appropriate function.
Details of each command will be described in subsequent sections. The Enum Command-
Type is used to represent the command type, including values REGISTER, ALTER, SHOW,
DELETE, QUIT, and INVALID, corresponding to the command types Register, Alter, Show,
Delete, Quit, and an invalid command, respectively.
• Function call
getCommandType("Show [:10]")
Return value:
SHOW
• Function call
getCommandType("Quit")
Return value:
QUIT
• Function call
getCommandType("Showall")
Return value:
INVALID
3.3 Enterprise
Requirement: Define the body of the initialized struct Enterprise with the following
attributes:
• booth_index: Integer type, stores the index of the booth registered by the enterprise.
• name: Character array type, stores the full name of the enterprise.
• abbre: Character array type, stores the abbreviation of the enterprise.
• itemValue: Value of the item at the booth (details in section 3.9)
• itemWeight: Weight of the item at the booth (details in section 3.9)
||booth_index||name||abbre||itemValue||itemWeight||
Before the event, the organizing committee will send a booth layout to all relevant enterprises.
Where:
If the booth_index field is left blank, the default booth assigned to the enterprise is
calculated based on the formula:
In the specific case where booth_number is left blank, if the calculated index corresponds
to an invalid state (i.e., a booth that is already registered), increment the index by one until
an empty booth is found. If no empty booth is found upon reaching the upper limit, decrement
the index by one until an empty booth is located. Once a suitable booth is identified, change
its status to registered and return a successful registration.
In other cases, if the booth being registered is empty, set its status to registered and return
a successful registration. Otherwise, return an unsuccessful registration.
Upon successful registration, update the corresponding values in the enterprise array.
Assume that all Register commands entered are valid and fall under one of the two scenarios
above.
• Requirement: Assist the enterprise in registering an abbreviation and booth. Return the
corresponding values in out_booth and out_abbre, and update both the status and enter-
prise arrays accordingly.
• Generate an abbreviation for the enterprise -> Call getAbbreviation to return the
string "V". Assign this value to out_abbre.
• Check and update map[0][1] = 1. Assign the value 1 to out_booth.
• Create an enterprise with abbre as "V", itemValue =2, itemWeight=2 and booth as
1, then add it to the array at enterpriseArray[0].
• Generate an abbreviation for the enterprise -> Call getAbbreviation to return the
string "FS". Assign this value to out_abbre.
• Calculate the booth index using the formula:
index = (2 ∗ 30)%26 = 8
At map[0][8], the status is 1, so increment the index. Since subsequent booths are
also occupied, decrement the index.
At map[0][7], the status remains 1, so continue decrementing until reaching index =
6, where the status is 0. Thus, index = 6 is suitable.
• With index = 6, itemV alue = 2, itemW eight = 2 and abbre = ”F S”, proceed
with registration as in the example above.
The Show command displays information for one or more booths. Show commands can include:
Show map
Show &0
Show &1
Show #0
Show #1
Show [num]
Show [from_index:to_index]
Details:
• Show map: Displays the layout of the booth map. The print format is as follows:
|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|
–-
|status_0|...|
–-
|status_15|...|
• Show &0: Displays the indices of all booths currently unregistered. The print format is:
Index[index_0, index_1,...]
• Show &1: Displays the indices of all booths currently registered. The print format is:
Index[index_0, index_1,...]
• Show #0: Displays the total count of booths currently unregistered. The print format is:
Total: total_0
• Show #1: Displays the total count of booths currently registered. The print format is:
Total: total_1
• Show [num]: Displays detailed information of the booth at the specified index num. If
the booth at num is empty, displays "NONE". The print format follows the printEnter-
priseDetails function.
• Show [from_index:to_index]: Displays detailed information for booths from index from_index
to to_index. If a booth at a given index is empty, displays "NONE". The print format is:
The Alter command is used to change the booth that an enterprise has registered. The item-
Value and itemWeight fields are specified as non-modifiable using the Alter command.
Where:
Detailed Description
Assume that all Alter commands received are valid and belong to one of the two cases
above.
Additional Requirement:
After a successful change, the system must update both the booth status array and the
enterprise information array to ensure data consistency.
– newBooth: The new booth index to switch to. If this value is -1, the system will
automatically find the nearest vacant booth.
– out_booth: Pointer containing the registered booth after alteration.
– out_abbre: Pointer containing the enterprise’s abbreviation.
• Return Value: Return booth_index + 200 and assign this to out_booth if the adjustment
is successful. If unsuccessful, return booth_index + 100 and assign it to out_booth.
• Requirement: Help the enterprise switch booths, updating the values in out_booth and
out_abbre, and adjust both the booth status array and the enterprise information array
for data consistency. If newBooth is unspecified, the system will automatically locate and
register the nearest vacant booth.
A registered booth can be deleted using the Delete command. The command syntax is:
Where:
Assume that the booth being deleted belongs to the corresponding enterprise, with no
exceptions. Deletion is an action that updates the booth status array at that position to vacant
and removes the enterprise from the enterprise array.
This is a general function to handle and call the corresponding command function based on the
user input.
Assume each participating student has a knapsack to carry items received from each booth.
Each knapsack has a maximum capacity, with a total weight limit of 15. Each booth has one
item with a specific weight and value, where item weight is an integer in the range [1,10] and
item value is an integer in the range [-5,5].
The student needs to visit booths and collect the optimal set of items to achieve the highest
total value without exceeding the knapsack’s capacity.
• Return Value: The maximum total value the student can collect.
• Requirement: Implement the function to help the student find an optimal list of booths
to maximize the item value.
The most suitable and optimal selection includes booths: 0, 3, and 14 with:
• Total value: 12
• Total weight: 8
The booth combination {5, 13, 14} also yields a maximum value of 12; however, the total
weight is 10. Although this does not exceed the knapsack’s maximum capacity, it is not
the most optimal solution.
4 Submission
Students should download the following files from the course website:
The file jobfair.c is the initial source code. Students must use this source code and imple-
ment their solution between the following lines:
For submission, students should upload their assignment on the LMS of the course. Stu-
dents will enter their assignment code in the same manner as previous exercises. The code
submitted should be the implementation written between the lines above. Students are not
allowed to include any additional libraries other than those provided in the initial source code.
The submission platform provides the following options:
• Trial Submission Area: Students can submit their work and have it tested on 5 test
cases to identify syntax errors and basic logic errors. Submissions can be made an un-
limited number of times here.
• Official submission areas will be announced later.
In each area, except the Trial Submission Area, students can make up to 10 submis-
sions. For each submission, students have 10 minutes to submit and check their code. Only
the first "Check" click is counted for scoring; subsequent attempts will not count. Scores will
be displayed only after you click "Complete Submission." The highest score from all attempts
will be used as the final score.
The submission deadline is provided on the designated area on the site. The link will
automatically close at the deadline, preventing late submissions. To avoid potential submission
issues, students MUST submit their work at least one hour before the deadline.
Students must verify their program on MinGW and in the Trial Submission Area
before final submission.
5 Assignment Harmony
The final exam for this course will include some Harmony questions based on the content of
the assignment. Assume the assignment score achieved by a student is a (out of 10), and the
total score for the Harmony questions is b (out of 5). Let x be the final assignment score after
Harmony. The final score will be combined with 50% of the Harmony score as follows:
• If a = 0 or b = 0, then x = 0
• If both a and b are non-zero, then
a a
x= + HARM ( , b)
2 2
where:
2xy
HARM (x, y) =
x+y
Students must complete the assignment independently. If a student cheats on the assign-
ment, they will be unable to answer the Harmony questions and will receive a score of 0 for the
assignment.
Students must answer the Harmony questions on the final exam. Failure to answer will
result in a score of 0 for the assignment and course failure. No explanations or exceptions
will be accepted.
6 Handling Cheating
The assignment must be completed independently. Cheating includes the following cases:
• Unusual similarities between code submissions. In this case, ALL submissions will be
considered cheating. Students must protect their assignment code.
• Students cannot explain the code they submitted, except for the pre-existing code pro-
vided in the initial program. Students may refer to any resource, but they must understand
every line of code they write. If a student does not fully understand the code from a source,
they are strongly advised NOT to use it; instead, rely on their learning.
• Submitting another student’s work under their account.
If cheating is confirmed, students will receive a 0 for the entire course (not just the assignment).
NO EXPLANATIONS
OR EXCEPTIONS WILL BE ACCEPTED!
After each assignment is submitted, some students will be randomly selected for an inter-
view to prove that the assignment submitted is their own work.