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 sales information:
Display the heading: Join 'Department' with week number (1 to 6).
Loop through each department: Using a loop from 1 to 8 (for each department), initialize a line variable to hold the data.
Inner loop for weeks: Use another loop from 1 to 6 for each week, joining the sales figures from the 2D array into the line variable. Each sales figure needs to be formatted to show two decimal places in currency format.
Output the line variable: After looping through all weeks for a department, display the completed line.
Sign up now to view full answer, or log in if you already have an account!
Answer
To display underperforming departments:
Display the heading: Set the heading for underperforming departments for each week (1 to 6).
Initialize sum variable: Start a sum variable at zero for calculations.
Calculate weekly averages: Loop through each week to get the average sales figure.
Loop for each week: For each department, check if sales are below average. If true, display the department name and sales figure formatted as currency. Repeat for all weeks.
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 add a new week:
Assign the file name: Use the correct week number for the text file, e.g., 'Week 7.txt'.
Rewrite command: Ensure the previous data is archived correctly by rewriting the file.
Loop for departments: For each department (1 to 8), loop through the current week and archive data.
Increasing start variable: After archiving, increment the start variable for the data movement process.
Random data generation: Loop to populate sales data for the new week (Week 7) with random values in the range of R500 to R5000.
Display updated arrays: Finally, output the updated sales figures including the newly added week.