SlideShare a Scribd company logo
Sir Zahid Ali Bhatti
00971568047507
00923242415561
COMPUTER SCIENCE
PRE-RELEASE MATERIAL MAY / JUNE 2018
O LEVEL - COMPUTER SCIENCE 2210
IGCSE - COMPUTER SCIENCE 0478
Sir Zahid Ali Bhatti
00971568047507
00923242415561
PRE-RELEASE MATERIAL JUNE 2018
 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.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
PRE-RELEASE MATERIAL JUNE 2018
 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.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
PRE-RELEASE MATERIAL JUNE 2018
 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.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
PRE-RELEASE MATERIAL JUNE 2018
 TASK 1 - Record the yield.
 Write a program for TASK 1 to record the milk yields for a week. The program records
and stores the identity code number and the yield every time a cow is milked.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
PRE-RELEASE MATERIAL JUNE 2018
 TASK 2 - Calculate the statistics.
 Using your recorded data from TASK 1, calculate and display the total weekly volume
of milk for the herd to the nearest whole litre. Calculate and display the average yield
per cow in a week to the nearest whole litre.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
PRE-RELEASE MATERIAL JUNE 2018
 TASK 3 - Identify the most productive cow and cows that are producing a low volume
of milk.
 Extend TASK 2 to identify and display the identity code number and weekly yield of
the cow that has produced the most milk. Also identify and display the identity code
numbers of any cows with a yield of less than 12 litres of milk for four days or more
in the week.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
TASK 1 - SOLUTION
 Task 1
 Input “type the number of cows in your herd…: “, Cherd
 Dim cowid (cherd)
 Dim cowyield (cherd)
 Dim lessmilk (cherd)
 Dim tmilk, havg
 Dim maxcid, mincid
 Dim Min, Max
Finding the herd size and
Variable declaration
Sir Zahid Ali Bhatti
00971568047507
00923242415561
TASK 1 – SOLUTION CONTINUE
For a=1 to cherd
Input “ type the cow ID ..: “, cowid(a)
While cowid(a)<100 or cowid(a) >999
Input “Wrong cow id, please type the correct cow ID ... : “, cowid(a)
End while
for d=1 to a
While cowid(a)=cowid(d)
Input “Duplicate cow id, please type the correct cow ID ... : “, cowid(a)
End while
next d
cowyield (a) = 0 ; lessmilk (a)=0
Next c
Validating and recording
unique Cow ID, and
variables initialization.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
TASK 1 – SOLUTION CONTINUE
 For d=1 to 7
 Print “ Milk Yield for the Day “, d
 For a=1 to cherd
 Print “Milk Yield Details of Cow ID ”, cowid(a)
 Input “Type the milk yield (litres) for session 1..: “,
s1
 Input “Type the milk yield (litres) for session 2..: “,
s2
 cowyield (a) = round(cowyield (a) + s1 + s2,1)
 if s1+s2<12 then
 lessmilk(a)=lessmilk(a)+1
 End if
 Next a
 Next d
This is the part work of task 3,
I did it here because, in this
task we are recording the milk
production of this herd of
cows
Recording the milk yield twice
a day, seven days a week,
correct to one decimal place.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
TASK II - SOLUTION
 Tmilk=0
 For a=1 to cherd
 tmilk=round(tmilk+cowyield(a),0)
 next a
 havg=round(tmilk/cherd,1)
 print “Total weekly volume of milk: “, tmilk
 print “Average weekly volume of milk: “, havg
 for a=1 to cherd
 print “Cow ID: “, cowed(a), “ Total Yield: “, cowyield(a), “ Average Yield per Week: “, round(cowyield(a)/7,
1)
 next a
Calculating and displaying,
the average & total weekly
volume of milk, nearest to the
whole litre
Calculate and displaying the
average yield per cow in a week,
correct to one decimal place.
Sir Zahid Ali Bhatti
00971568047507
00923242415561
TASK III – SOLUTION
 maxcid=0
 mincid=0
 min=9999
 max=0
 For a=1 to cherd
 If cowyield(a) > max then
 Max=cowyield(a) ; Maxcid=cowed(a)
 End if
 If cowyield(a)<min then
 Min=cowyield(a) ; Mincid=cowed(a)
 End if
 Next a
 Print “Cow ID: “, maxcid, “ has produced most milk “, max
 Print “Cow ID: “, mincid, “ has produced least milk “, min
Identifying the
most productive
cow
Identifying the
least productive
cow
Sir Zahid Ali Bhatti
00971568047507
00923242415561
EXTENDED TASK II – SOLUTION CONTINUE
 for a=1 to cherd
 if leemilk(a)=> 4 then
 print “Cow ID: “, cowid(a), “ has produced less than 12 litters of milk for “, lessmilk(a), “days in a week”
 next a
identifying and displaying the cow
with a yield of less than 12 litres,
Part working of this task was
done with task 1

More Related Content

Similar to Computer Science Pre Release Material June 2018

ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...
ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...
ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...
rowala30
 
INDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. Lalkuan
INDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. LalkuanINDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. Lalkuan
INDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. Lalkuan
Vikas Tiwari
 
Dairy Farm Business Planning
Dairy Farm Business Planning Dairy Farm Business Planning
Dairy Farm Business Planning Dr. Tom Armstrong
 
A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...
A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...
A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...
Ajjay Kumar Gupta
 
Business proposal-agribusiness
Business proposal-agribusinessBusiness proposal-agribusiness
Business proposal-agribusinessKiera Syakira
 
AAVIN internship report
AAVIN internship reportAAVIN internship report
AAVIN internship report
Suja S
 
Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...
Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...
Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...
Ajjay Kumar Gupta
 
Poultry Business Plan Analysis
Poultry Business Plan AnalysisPoultry Business Plan Analysis
Poultry Business Plan Analysis
MD SALMAN ANJUM
 
HRM300 Fundamentals of Human Resource ManagementJob Descripti.docx
HRM300 Fundamentals of Human Resource ManagementJob Descripti.docxHRM300 Fundamentals of Human Resource ManagementJob Descripti.docx
HRM300 Fundamentals of Human Resource ManagementJob Descripti.docx
adampcarr67227
 
Business Plan for Dairy Industries
Business Plan for Dairy IndustriesBusiness Plan for Dairy Industries
Business Plan for Dairy Industries
Zarnab Ashraf
 
[Project] Optimization Model for Dairy Supply Chain
[Project] Optimization Model for Dairy Supply Chain[Project] Optimization Model for Dairy Supply Chain
[Project] Optimization Model for Dairy Supply Chain
Biswadeep Ghosh Hazra
 
The Smart Dairy Farms
The Smart Dairy FarmsThe Smart Dairy Farms
The Smart Dairy Farms
Monzer Osama Alchikh WARAK
 
Milk Processing Plant Presentation for Better valuation for dairy Farmer
Milk Processing Plant Presentation for Better valuation for dairy FarmerMilk Processing Plant Presentation for Better valuation for dairy Farmer
Milk Processing Plant Presentation for Better valuation for dairy Farmer
AnandKumar1848
 
milk farm in pakistan
milk farm in pakistanmilk farm in pakistan
milk farm in pakistan
Ahsan khokhar
 
Ways to Increase Dairy Yield
Ways to Increase Dairy YieldWays to Increase Dairy Yield
Ways to Increase Dairy Yield
abcsheds
 
Entrepreneurship idea and business plan (2)
Entrepreneurship idea and business                               plan (2)Entrepreneurship idea and business                               plan (2)
Entrepreneurship idea and business plan (2)
waseem raza
 
Businessplan 140125024630-phpapp02
Businessplan 140125024630-phpapp02Businessplan 140125024630-phpapp02
Businessplan 140125024630-phpapp02
Fady Malaty
 

Similar to Computer Science Pre Release Material June 2018 (20)

ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...
ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...
ALKAMAGIC PLAN 1350.pdf plan based of door to door delivery of alkaline water...
 
INDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. Lalkuan
INDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. LalkuanINDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. Lalkuan
INDUSTRIAL ATTACHMENT at Aanchal Dairy N.D.U.S.S. Lalkuan
 
Dairy Farm Business Planning
Dairy Farm Business Planning Dairy Farm Business Planning
Dairy Farm Business Planning
 
A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...
A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...
A2 Cow Milk Processing (Milk, Butter, Ghee & Paneer) Plant Business Plan. Soa...
 
Business proposal-agribusiness
Business proposal-agribusinessBusiness proposal-agribusiness
Business proposal-agribusiness
 
AAVIN internship report
AAVIN internship reportAAVIN internship report
AAVIN internship report
 
Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...
Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...
Dairy Farming to Produce Milk and Cattle Breeding Detailed Project Report, Pr...
 
Poultry Business Plan Analysis
Poultry Business Plan AnalysisPoultry Business Plan Analysis
Poultry Business Plan Analysis
 
Final-Report
Final-ReportFinal-Report
Final-Report
 
HRM300 Fundamentals of Human Resource ManagementJob Descripti.docx
HRM300 Fundamentals of Human Resource ManagementJob Descripti.docxHRM300 Fundamentals of Human Resource ManagementJob Descripti.docx
HRM300 Fundamentals of Human Resource ManagementJob Descripti.docx
 
Business Plan for Dairy Industries
Business Plan for Dairy IndustriesBusiness Plan for Dairy Industries
Business Plan for Dairy Industries
 
[Project] Optimization Model for Dairy Supply Chain
[Project] Optimization Model for Dairy Supply Chain[Project] Optimization Model for Dairy Supply Chain
[Project] Optimization Model for Dairy Supply Chain
 
The Smart Dairy Farms
The Smart Dairy FarmsThe Smart Dairy Farms
The Smart Dairy Farms
 
Milk Processing Plant Presentation for Better valuation for dairy Farmer
Milk Processing Plant Presentation for Better valuation for dairy FarmerMilk Processing Plant Presentation for Better valuation for dairy Farmer
Milk Processing Plant Presentation for Better valuation for dairy Farmer
 
milk farm in pakistan
milk farm in pakistanmilk farm in pakistan
milk farm in pakistan
 
Business plan
Business planBusiness plan
Business plan
 
Ways to Increase Dairy Yield
Ways to Increase Dairy YieldWays to Increase Dairy Yield
Ways to Increase Dairy Yield
 
Entrepreneurship idea and business plan (2)
Entrepreneurship idea and business                               plan (2)Entrepreneurship idea and business                               plan (2)
Entrepreneurship idea and business plan (2)
 
Dpr
DprDpr
Dpr
 
Businessplan 140125024630-phpapp02
Businessplan 140125024630-phpapp02Businessplan 140125024630-phpapp02
Businessplan 140125024630-phpapp02
 

Recently uploaded

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 

Recently uploaded (20)

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 

Computer Science Pre Release Material June 2018

  • 1. Sir Zahid Ali Bhatti 00971568047507 00923242415561 COMPUTER SCIENCE PRE-RELEASE MATERIAL MAY / JUNE 2018 O LEVEL - COMPUTER SCIENCE 2210 IGCSE - COMPUTER SCIENCE 0478
  • 2. Sir Zahid Ali Bhatti 00971568047507 00923242415561 PRE-RELEASE MATERIAL JUNE 2018  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.
  • 3. Sir Zahid Ali Bhatti 00971568047507 00923242415561 PRE-RELEASE MATERIAL JUNE 2018  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.
  • 4. Sir Zahid Ali Bhatti 00971568047507 00923242415561 PRE-RELEASE MATERIAL JUNE 2018  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.
  • 5. Sir Zahid Ali Bhatti 00971568047507 00923242415561 PRE-RELEASE MATERIAL JUNE 2018  TASK 1 - Record the yield.  Write a program for TASK 1 to record the milk yields for a week. The program records and stores the identity code number and the yield every time a cow is milked.
  • 6. Sir Zahid Ali Bhatti 00971568047507 00923242415561 PRE-RELEASE MATERIAL JUNE 2018  TASK 2 - Calculate the statistics.  Using your recorded data from TASK 1, calculate and display the total weekly volume of milk for the herd to the nearest whole litre. Calculate and display the average yield per cow in a week to the nearest whole litre.
  • 7. Sir Zahid Ali Bhatti 00971568047507 00923242415561 PRE-RELEASE MATERIAL JUNE 2018  TASK 3 - Identify the most productive cow and cows that are producing a low volume of milk.  Extend TASK 2 to identify and display the identity code number and weekly yield of the cow that has produced the most milk. Also identify and display the identity code numbers of any cows with a yield of less than 12 litres of milk for four days or more in the week.
  • 8. Sir Zahid Ali Bhatti 00971568047507 00923242415561 TASK 1 - SOLUTION  Task 1  Input “type the number of cows in your herd…: “, Cherd  Dim cowid (cherd)  Dim cowyield (cherd)  Dim lessmilk (cherd)  Dim tmilk, havg  Dim maxcid, mincid  Dim Min, Max Finding the herd size and Variable declaration
  • 9. Sir Zahid Ali Bhatti 00971568047507 00923242415561 TASK 1 – SOLUTION CONTINUE For a=1 to cherd Input “ type the cow ID ..: “, cowid(a) While cowid(a)<100 or cowid(a) >999 Input “Wrong cow id, please type the correct cow ID ... : “, cowid(a) End while for d=1 to a While cowid(a)=cowid(d) Input “Duplicate cow id, please type the correct cow ID ... : “, cowid(a) End while next d cowyield (a) = 0 ; lessmilk (a)=0 Next c Validating and recording unique Cow ID, and variables initialization.
  • 10. Sir Zahid Ali Bhatti 00971568047507 00923242415561 TASK 1 – SOLUTION CONTINUE  For d=1 to 7  Print “ Milk Yield for the Day “, d  For a=1 to cherd  Print “Milk Yield Details of Cow ID ”, cowid(a)  Input “Type the milk yield (litres) for session 1..: “, s1  Input “Type the milk yield (litres) for session 2..: “, s2  cowyield (a) = round(cowyield (a) + s1 + s2,1)  if s1+s2<12 then  lessmilk(a)=lessmilk(a)+1  End if  Next a  Next d This is the part work of task 3, I did it here because, in this task we are recording the milk production of this herd of cows Recording the milk yield twice a day, seven days a week, correct to one decimal place.
  • 11. Sir Zahid Ali Bhatti 00971568047507 00923242415561 TASK II - SOLUTION  Tmilk=0  For a=1 to cherd  tmilk=round(tmilk+cowyield(a),0)  next a  havg=round(tmilk/cherd,1)  print “Total weekly volume of milk: “, tmilk  print “Average weekly volume of milk: “, havg  for a=1 to cherd  print “Cow ID: “, cowed(a), “ Total Yield: “, cowyield(a), “ Average Yield per Week: “, round(cowyield(a)/7, 1)  next a Calculating and displaying, the average & total weekly volume of milk, nearest to the whole litre Calculate and displaying the average yield per cow in a week, correct to one decimal place.
  • 12. Sir Zahid Ali Bhatti 00971568047507 00923242415561 TASK III – SOLUTION  maxcid=0  mincid=0  min=9999  max=0  For a=1 to cherd  If cowyield(a) > max then  Max=cowyield(a) ; Maxcid=cowed(a)  End if  If cowyield(a)<min then  Min=cowyield(a) ; Mincid=cowed(a)  End if  Next a  Print “Cow ID: “, maxcid, “ has produced most milk “, max  Print “Cow ID: “, mincid, “ has produced least milk “, min Identifying the most productive cow Identifying the least productive cow
  • 13. Sir Zahid Ali Bhatti 00971568047507 00923242415561 EXTENDED TASK II – SOLUTION CONTINUE  for a=1 to cherd  if leemilk(a)=> 4 then  print “Cow ID: “, cowid(a), “ has produced less than 12 litters of milk for “, lessmilk(a), “days in a week”  next a identifying and displaying the cow with a yield of less than 12 litres, Part working of this task was done with task 1