SlideShare a Scribd company logo
1 of 13
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

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. LalkuanVikas 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 reportSuja 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 AnalysisMD 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.docxadampcarr67227
 
Business Plan for Dairy Industries
Business Plan for Dairy IndustriesBusiness Plan for Dairy Industries
Business Plan for Dairy IndustriesZarnab 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 ChainBiswadeep Ghosh Hazra
 
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 FarmerAnandKumar1848
 
milk farm in pakistan
milk farm in pakistanmilk farm in pakistan
milk farm in pakistanAhsan khokhar
 
Ways to Increase Dairy Yield
Ways to Increase Dairy YieldWays to Increase Dairy Yield
Ways to Increase Dairy Yieldabcsheds
 
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-phpapp02Fady Malaty
 

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

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
 
Shubham
ShubhamShubham
Shubham
 

Recently uploaded

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Recently uploaded (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

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