IEB 2021: Server Technician Assignment

HardGrade 12

Digital Nimbus hosts remote servers, each with a role (File/Print/Email/Custom) and possibly a fault. Technicians each specialise in one role. You need Technician and Server classes, a manager holding all servers in an array, and an assignment algorithm: process technicians in order, and for each one, walk the servers in order assigning up to 4 unassigned servers whose role matches the technician's speciality. See the 📄 Exam Paper tab for the verbatim question. Platform note: the original paper also has a Question 7 asking you to render and save a grid "map" of server locations to a text file — that file-output-only requirement isn't included here since it doesn't change program behaviour that can be tested via stdin/stdout.

Input / Output

Input: Line 1: an integer N — number of technicians. Next N lines, '#'-separated: <techID>#<name>#<experience>#<roleSpecialty> Next line: an integer M — number of servers. Next M lines, '#'-separated: <serverID>#<location>#<fault>#<role> Output: after assigning technicians to servers, print every server's toString (see Question 3.6's format), in the order the servers were given, separated by one blank line (none after the last one).

Examples

Input

1
T-X1#Amy Zhou#2#file
2
S001#A1#Power#File
S002#B2#Security#file

Expected Output

Server: S001(Role: File)
Fault: Power @ A1
Assigned to: Amy Zhou, T-X1, 2 year(s) [file]

Server: S002(Role: File)
Fault: Security @ B2
Assigned to: Amy Zhou, T-X1, 2 year(s) [file]

+ 1 hidden test checked on Submit.

Files

Main.java is the entry point. Add extra classes for OOP exercises — they compile together.

Technician.java
Loading...

Run your code to see test results here.