4. A primary school is conducting a survey on the popularity of certain colours. Students ar asked to vote for any of four choices: red, blue, green, none. If red, blue or green is not the favourite, students vote for 'none'. Write an algorithm to find and print the (i) number of students that voted for EACH of the colours: red, blue green (ii) TOTAL number of students that voted for red, blue or green. Assume that on the day of the survey, 150 students are present. Also assume that all votes are valid.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question
4.
A primary school is conducting a survey on the popularity of certain colours. Students are
asked to vote for any of four choices: red, blue, green, none. If red, blue or green is not
the favourite, students vote for 'none'.
Write an algorithm to find and print the
(i)
number of students that voted for EACH of the colours: red, blue green
(ii)
TOTAL number of students that voted for red, blue or green.
Assume that on the day of the survey, 150 students are present.
Also assume that all votes are valid.
Transcribed Image Text:4. A primary school is conducting a survey on the popularity of certain colours. Students are asked to vote for any of four choices: red, blue, green, none. If red, blue or green is not the favourite, students vote for 'none'. Write an algorithm to find and print the (i) number of students that voted for EACH of the colours: red, blue green (ii) TOTAL number of students that voted for red, blue or green. Assume that on the day of the survey, 150 students are present. Also assume that all votes are valid.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr