Question: 1. This must be done in C++. Your assignment should be organised into: (a) A driver file containing your main() function. (b) A header file
1. This must be done in C++. Your assignment should be organised into: (a) A driver file containing your main() function. (b) A header file containing the prototypes for the functions you write. (c) An implementation file containing the implementations of your functions.
2. Your code must compile on Banshee with the compilation instructions you provide in Readme.txt.
3. You are not allowed to use classes.
4. You can use structs, but without member functions.
5. The main() function should make it clear what is going in, and shouldn't be too large.
Structure of the code
If your program were to be compiled into the executable RepCent, it must run as follows: $ ./RepCent Number Vehicles.txt Mechanics.txt Problems.txt Fixes.txt Output-file The Repair Shop runs on a strict quota system and closes after handling the number of vehicles specified by Number. It also closes when there are no vehicles left to see. There is otherwise no sense of time in this program, so it's possible every vehicle could be dealt with by the same mechanic. Errors should be reported to standard error. Runtime progress should be reported to standard out. A summary of what happens to each vehicle should be passed to whatever file is specified on the command line as the Output-file. The 4 txt files listed on the command line are data files. When you load the data files, you should output the content in a sensible format to make it clear that your input processing works. The data file names shouldn't be hard coded. If errors are detected in reading files you should report the problem and ignore the line. You should deal with the vehicles on a one by one basis, in the order specified in the input file. Each vehicle will need to be worked on by a randomly chosen mechanic. The mechanic will attempt to diagnose the correct problem, with the percentage chance of doing so being some sensible function of the mechanic's quality and the problem determination complexity. You should specify your detection function in your Readme.txt file. If the mechanic fails to identify the correct problem, the mechanic will guess at the problem, equally likely to specify any of the possible problems including the correct one. Once a vehicle is determined to have a particular problem, the mechanic will apply the x associated with that problem. The chance of the treatment working should be some sensible function of the mechanic's quality and the problem x complexity. If it's the wrong x, the chance of it working should be 25% of the chance when using the correct x. You should specify your success function in your Readme.txt file. Once given a x the vehicle leaves, whether the x is successful or not. Sensible with respect to the functions above means that increasing or decreasing the arguments should change the chance of success in a common sense way, so either a higher quality mechanic, lower problem determination complexity, or a lower problem x complexity, give better chances of success.
Inputs:
1. Vehicles.txt: No more than 20 entries. Type,Colour,Plate,Problem. Example: Car,Red,ZX342DC,1. Car,Blue,WF312AL,3. Bus,White,AP116DL,1. Motorbike,Green,DE321AX,2. Truck,Black,MO345CP,5. The Problem value corresponds to the Problems listed in the le Problems.txt. Plates need to have 2 upper case letters, followed by 3 digits, followed by two upper case letters.
2. Mechanics.txt: No more than 5 entries. Name,Gender,Quality. Boris Barn-Owl,M,77. Ernie Edwards,M,60. Frankie Fisher,M,75. Geraldine Gardner,F,73. Henrietta Helpful,F,80. The name cannot be empty. Gender is a single character. The quality is a percentage in the range 1 to 100.
3. Problems.txt: No more than 20 entries. Name,Problem determination complexity,Problem treatment complexity,Treatment. Problem determination complexity and problem treatment complexity are percentages in the range 1 to 100. The lower the problem determination complexity, the easier it is to recognise the problem. The higher the problem treatment complexity, the harder it is to apply the x successfully. The Fixes corresponds to the Fixes listed in the le Files.txt. Out of petrol,30,10,4. Flat tire,20,20,1. Steering wheel missing,5,20,2. Broken internal component,80,70,6. Broken external component,50,50,6. Flat battery,15,30,3. Worn brakes,30,30,5. 4. Treatments.txt: No more than 20 entries. Name. Replace tire. Add a steering wheel. Replace battery. Add petrol. Replace brake pads. Replace component. Replace whole vehicle. If a given data file has an incorrectly formatted line, you should report the problem and ignore that line.
Output:
Errors should be reported to standard error. Runtime progress, included the file loading output, should be reported to standard out. A summary of what happens to each vehicle should be passed to whatever file is specified on the command line as the Output-file. This should include the mechanic seen, the actual problem, the problem diagnosed, and the x applied, and whether the x was successful.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
