Bits of Bytes.co

IGCSE / GCSE Computer Science

  • Home
  • 1 - Theory of Computer Science
  • 2 - Practical Problem Solving and Programming
  • Pre-Release Material
    • 2018 June >
      • 22 >
        • 22 - Cow Task
        • 22 - Task 1
        • 22 - Task 2
        • 22 - Task 3
  • 1 - Computer Systems (2023)
Picture
MENU
  • Home
  • 1 - Theory of Computer Science
  • 2 - Practical Problem Solving and Programming
  • Pre-Release Material
    • 2018 June >
      • 22 >
        • 22 - Cow Task
        • 22 - Task 1
        • 22 - Task 2
        • 22 - Task 3
  • 1 - Computer Systems (2023)

Pre-Release Breakdown

Home  >  Pre-Release Material  >  2018 June  >  22 - Cows

0478 Computer Science

June 2018 Pre released material - 22


This pre-release task requires you to help a farmer solve his cow milking problem!  below are the requirements given to you...
A farmer records the milk production of a herd of cows. Every cow has a unique 3-digit identity code. Each cow can be milked twice a day, seven days a week.
The volume of milk from each cow is recorded in litres correct to one decimal place (yield) every time the cow is milked.
The size of the herd is fixed.
At the end of the week the total and the average yield for each cow for that week is calculated.
The farmer identifies the cow that has produced the most milk that week. The farmer also identifies any cows that have produced less than 12 litres of milk on four or more days that week.

A program is required to record the yield for each cow every time it is milked, calculate the total weekly volume of milk for the herd and the average yield per cow in a week.
The program must also identify the cow with the best yield that week and identify any cows with a yield of less than 12 litres of milk for four or more days that week.

Write and test a program or programs for the farmer.
• Your program or programs must include appropriate prompts for the entry of data.
• Error messages and other output need to be set out clearly and understandably.
​• All variables, constants and other identifiers must have meaningful names. You will need to complete these three tasks. Each task must be fully tested.

Task Breakdown


Key points
Before we jump into writing a program like this, it can be very helpful to break the information down to fully understand the task at hand.

Purpose: to record milk production for a herd of cows

Practical information
The farmer has a herd of cows
Each cow has a UNIQUE 3 digit ID number
Each Cow is milked twice a day
Each cow is milked 7 days a week 

Practical information
What do we do with this information?
Record the volume of milk from each milking session in liters, to 2 decimal places
Calculate the total milk milked from the whole herd at the end of the week
Calculate the average yield from all milking session that week 

​Identify the cow that has produced the most milk all week -
Identify all cows that have yielded less than 12 liters in a day for more than 4 days 

Hopefully breaking down a problem in such a way may help you to get a better grasp of the problem before attempting the tasks.



Continue to task 1


Task 1
Est. 2015 - Copyright © 2020