subject

A programmer for a weather website needs to display the proportion of days with freezing temperatures in a given month. Their algorithm will operate on a list of temperatures for each day in the month. It must keep track of how many temperatures are below or equal to 32. Once it's done processing the list, it must display the ratio of freezing days over total days.
Which of these correctly expresses that algorithm in pseudocode?
A.
numFreezing ← 0

numDays ← 0

FOR EACH temp IN temps {

IF (temp ≤ 32) {

numFreezing ← numFreezing + 1

}

numDays ← numDays + 1

DISPLAY(numFreezing/numDays)

}

B.
numFreezing ← 0

numDays ← 0

FOR EACH temp IN temps {

IF (temp ≤ 32) {

numFreezing ← numFreezing + 1

}

numDays ← numDays + 1

}

DISPLAY(numFreezing/numDays)

C.
numFreezing ← 0

numDays ← 0

FOR EACH temp IN temps {

IF (temp < 32) {

numFreezing ← numFreezing + 1

}

numDays ← numDays + 1

}

DISPLAY(numFreezing/numDays)

D.
numFreezing ← 0

numDays ← 0

FOR EACH temp IN temps {

IF (temp ≤ 32) {

numFreezing ← numFreezing + 1

numDays ← numDays + 1

}

}

DISPLAY(numFreezing/numDays)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Name the range function that would generate the following list of integers values: 0,1,2,3,4,5.
Answers: 1
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
question
Computers and Technology, 23.06.2019 13:10
What is domain name system (dns)? allows dynamic ip address allocation so users do not have to have a preconfigured ip address to use the network converts ip addresses into domains, or identifying labels that use a variety of recognizable naming conventions the efficient coexistence of telephone, video, and data communication within a single network, offering convenience and flexibility not possible with separate infrastructures the integration of communication channels into a single service
Answers: 2
You know the right answer?
A programmer for a weather website needs to display the proportion of days with freezing temperature...
Questions
question
English, 13.03.2022 05:10
question
Mathematics, 13.03.2022 05:10
question
Mathematics, 13.03.2022 05:10
Questions on the website: 13722361