Photo AI

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 icon

Question 3

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.png

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

Answer

To display the content of the arrSales array:

  1. Display Heading: Begin by setting the header of the output as 'Department' along with each corresponding week number from Week 1 to Week 6.
  2. Loop Through Departments: For each department (i.e., iterate iRow from 1 to 8), retrieve the weekly sales data.
  3. 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.
  4. 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.
  5. Display Output: Finally, output the formatted data for all departments.

Step 2

Button [3.2 - Display underperforming departments]

99%

104 rated

Answer

To display the underperforming departments:

  1. Display Heading: Start with a heading indicating 'Underperforming Departments per Week'.
  2. Loop Through Weeks: For each week (i.e., column from 1 to 6), initialize a sum variable to zero.
  3. Nested Loop for Departments: Within the week loop, use another loop (i.e., iterate row from 1 to 8) to accumulate the total sales.
  4. Calculate Average: After processing all departments for the week, calculate the average sales figure: ext{Average} = rac{ ext{total sales}}{ ext{number of departments}}
  5. 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.
  6. Display Results: Output the results distinctly for each week.

Step 3

Button [3.3 - New week]

96%

101 rated

Answer

To manage the new week's data:

  1. Assign Filename: Create the text file name based on the current week (e.g., 'Week 1.txt').
  2. Rewrite Data: Open the file for writing and store the sales data for the current week.
  3. Move Old Data: Loop through the array to shift week data: for Week 2, move Week 1 data into its position, and so on.
  4. Generate New Sales Data: Randomly generate sales figures for the new week in the range of R500 to R5000.
  5. Populate Array: Populate the sales figures for the new week in arrSales array and display the updated results.

Join the NSC students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;