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
if cowid(a)=cowid(d)
Input “Duplicate cow id, please type the correct cow ID ... : “, cowid(a)
end if
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
 
Business Plan for Dairy Industries
Business Plan for Dairy IndustriesBusiness Plan for Dairy Industries
Business Plan for Dairy IndustriesZarnab Ashraf
 
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
 
[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 farm in pakistan
milk farm in pakistanmilk farm in pakistan
milk farm in pakistanAhsan khokhar
 
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
 
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
 
Ways to Increase Dairy Yield
Ways to Increase Dairy YieldWays to Increase Dairy Yield
Ways to Increase Dairy Yieldabcsheds
 

Similar to Computer science pre release material june 2018 (18)

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
 
Business Plan for Dairy Industries
Business Plan for Dairy IndustriesBusiness Plan for Dairy Industries
Business Plan for Dairy Industries
 
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
 
[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 farm in pakistan
milk farm in pakistanmilk farm in pakistan
milk farm in pakistan
 
Entrepreneurship idea and business plan (2)
Entrepreneurship idea and business                               plan (2)Entrepreneurship idea and business                               plan (2)
Entrepreneurship idea and business plan (2)
 
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
 
Dpr
DprDpr
Dpr
 
Ways to Increase Dairy Yield
Ways to Increase Dairy YieldWays to Increase Dairy Yield
Ways to Increase Dairy Yield
 
Business plan
Business planBusiness plan
Business plan
 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
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
 
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
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
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
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
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
 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
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
 
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
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
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
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

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 if cowid(a)=cowid(d) Input “Duplicate cow id, please type the correct cow ID ... : “, cowid(a) end if 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