The online-shopping website of a company called MajorMax allows customers to buy items online from various departments at their store - NSC Information Technology - Question 3 - 2017 - Paper 1
Question 3
The online-shopping website of a company called MajorMax allows customers to buy items online from various departments at their store. The manager of the company mus... show full transcript
Worked Solution & Example Answer:The online-shopping website of a company called MajorMax allows customers to buy items online from various departments at their store - NSC Information Technology - Question 3 - 2017 - Paper 1
Step 1
Button [3.1 - Sales information]
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To display the content of the arrSales array:
Display Heading: Begin by setting the header of the output as 'Department' along with each corresponding week number from Week 1 to Week 6.
Loop Through Departments: For each department (i.e., iterate iRow from 1 to 8), retrieve the weekly sales data.
Inner Loop for Weeks: Within this department loop, create another loop (i.e., iterate iCol from 1 to 6) to extract and format the sales figures.
Join Sales Figures: Combine the sales data into a single line for each department in the desired format, ensuring monetary values have TWO decimal places.
Display Output: Finally, output the formatted data for all departments.
Sign up now to view full answer, or log in if you already have an account!
Answer
To display the underperforming departments:
Display Heading: Start with a heading indicating 'Underperforming Departments per Week'.
Loop Through Weeks: For each week (i.e., column from 1 to 6), initialize a sum variable to zero.
Nested Loop for Departments: Within the week loop, use another loop (i.e., iterate row from 1 to 8) to accumulate the total sales.
Calculate Average: After processing all departments for the week, calculate the average sales figure:
ext{Average} = rac{ ext{total sales}}{ ext{number of departments}}
Identify Underperformers: Loop through departments again to check if their sales figures are less than the calculated average. If true, display department names and their sales figures in currency format.
Display Results: Output the results distinctly for each week.
Step 3
Button [3.3 - New week]
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To manage the new week's data:
Assign Filename: Create the text file name based on the current week (e.g., 'Week 1.txt').
Rewrite Data: Open the file for writing and store the sales data for the current week.
Move Old Data: Loop through the array to shift week data: for Week 2, move Week 1 data into its position, and so on.
Generate New Sales Data: Randomly generate sales figures for the new week in the range of R500 to R5000.
Populate Array: Populate the sales figures for the new week in arrSales array and display the updated results.