H SDD 2024
H SDD 2024
13 on 17/01/2024 10:2
Purpose
A CSV file stores the following data about the 100 companies:
♦ company name
♦ number of employees
♦ salary paid to CEO
The program will allow the user to enter the name of a company to find and display the
difference between that company’s CEO’s salary and the highest paid CEO of all 100
companies.
The program will also find the highest number of employees employed by a single
company, and the number of companies who employ within 10% of that figure.
Goldman
Assumptions
♦ the external file is current and updated regularly
Version 1.0 11
ownloaded by [email protected] from 217.181.30.13 on 17/01/2024 10:2
Input(s)
♦ Read the company name, number of employees and CEO salary from the file.
Process(es)
♦ Calculate how many companies employ within 10% of the highest number of
employees.
Output(s)
♦ Display the name of the chosen company, the name of the company with the
highest CEO salary and the difference between the two salaries or display
“Company not found”.
♦ Display the number of companies who employ within 10% of the highest number
of employees.
♦ Check your answers carefully, as you cannot return to part A after you hand it in.
♦ When you are ready, hand part A to your teacher or lecturer and collect part B.
Version 1.0 12
ownloaded by [email protected] from 217.181.30.13 on 17/01/2024 10:2
Each line of the CSV file stores the company name, the number of employees and the CEO
salary as shown below:
Fidelity,319,582235
iShares,853,523579
Aviragen,548,636367
Aviragen Therapeutics,501,630486
Southern,269,369821
Southern First,141,791140
Southern First Bancshares,623,304523
Goldman,440,850580
Nuveen,599,834853
…
A top level design for the main steps of the program is shown below.
Steps 2 and 3 will call the same function to return the position of the highest value.
Version 1.0 13
ownloaded by [email protected] from 217.181.30.13 on 17/01/2024 10:2
1b Using a recognised design technique, design a function called findMaxPos that will
return the position of the highest value in an array. This function will be used in
steps 2 and 3 of the program.
(4 marks)
♦ Check your answers carefully, as you cannot return to part B after you hand it in.
♦ When you are ready, hand part B to your teacher or lecturer and collect part C.
Version 1.0 14
ownloaded by [email protected] from 217.181.30.13 on 17/01/2024 10:2
Refinements
Version 1.0 15
ownloaded by [email protected] from 217.181.30.13 on 17/01/2024 10:2
1c Using the problem description and design, implement the program in a language of
your choice.
You should:
♦ use a single function to find and return the position of the highest CEO salary, and
the position of highest number of employees
♦ use procedures to:
— read data from the ‘companies.csv’ file to parallel arrays
— find and display the difference between the chosen company’s CEO salary and
the highest CEO salary
— find and display the highest number of employees employed by a single
company, and the number of companies who employ within 10% of that figure.
♦ test your program by using the company name ‘Goldman’
(15 marks)
Version 1.0 16
ownloaded by [email protected] from 217.181.30.13 on 17/01/2024 10:2
1d Step 2 of the program is tested with the following sample test data.
Grap,724,375000
Ver,163,1031000
Meto,728,816000
TelTo,252,1031000
Selop,555,842000
Sever,307,569000
Lehar,805,564000
EastA,401,320000
(i) Explain why the output from the refinements provided for step 2 would be incorrect
if the sample test data was used with ‘Selop’ entered as the company name.
(1 mark)
(ii) Describe the additional refinements that would be required before step 2.13 to
ensure that the correct company name(s) are found.
(2 marks)
Version 1.0 17
ownloaded by [email protected] from 217.181.30.13 on 17/01/2024 10:2
1e Evaluate the efficiency of your own program, with reference to the use of the
findMaxPos function.
(1 mark)
Version 1.0 18