Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Develop code

EasyMediumHard
123456789101112
Question 2

A commercial fruit orchard houses several varieties of apple trees.

Data collected for the trees is stored in parallel lists (arrays).

The data stored is:

  • the name of the variety
  • the ease of maintenance rating for that variety (1 is easiest and 3 is hardest)
  • the number of trees of that variety in the orchard
  • the average weight (in kg) of apples harvested per year from a single tree of that variety.

The orchard owner wants to present this data to local growers and recommend the best variety of apple tree to plant.

The best variety is defined as having the highest maintenance rating (1) and the largest annual harvest weight per tree among those with that rating.

Write a program to:

  • Calculate the total annual harvest weight produced by each variety.
  • Add this annual harvest weight to a data structure named tbl_annualHarvest.
  • Display a message informing the user what each field holds, such as variety name, rating, yield per tree, tree count, and total variety yield.
  • Display the data for each variety.
  • Calculate and display the total annual harvest weight produced by the entire orchard.
  • Find the recommended variety.
  • Display the recommended variety by name, rating, and yield per tree.

Your program should function correctly even if the number of varieties represented in the data is changed.

Below is an example of the expected output format:

Fields are: Variety, Rating, Yield (tree), Count, Total (variety)
Bramley 2 45.0 8 360.0
Gala 1 30.5 12 366.0
Fuji 3 50.0 5 250.0
Honeycrisp 1 35.0 10 350.0
Empire 2 28.0 6 168.0
Cox 3 22.0 4 88.0
Pink Lady 1 42.5 6 255.0
Total: 1837.0 kilograms
Recommended variety: Pink Lady rating: 1 yield: 42.5
[20]

Develop code Questions

  1. IGCSE
  2. /Computer Science
  3. /Develop code