C
C#3y ago
daniel1

tough homework 4

The school management held a poll on the readiness of the students to go on a trip. Each of the 200 school students had to answer a questionnaire and indicate y if they were ready to go on a trip or n if they were not ready to go on a trip. Write a program that takes the answers of the students and in addition you have to check whether the number of these students is a majority or not. An appropriate message must be displayed.
17 Replies
ero
ero3y ago
good luck!
daniel1
daniel1OP3y ago
"indicate y if they were ready to go on a trip or n if they were not ready to go on a trip." i dont understend this part
ero
ero3y ago
not a c# question, but y = yes and n = no the students indicate yes or no to the questionnaire
daniel1
daniel1OP3y ago
i know i just dont understand how am i supposed to type it out how do i have two diffrent intgers and i just dont load one in beacuse each student has to pick just one
Servator
Servator3y ago
Servator
Servator3y ago
Just random initialized list with bunch or 0 and 1's 104 student wants to go (1) 96 doesnt want (0)
ero
ero3y ago
what what is this what are you doing
Servator
Servator3y ago
wtf i didnt see indicate y part -_-
daniel1
daniel1OP3y ago
what does var stand for
ero
ero3y ago
they literally just need to take console input and count the amount of yesses and nos have you done literally any c# ever?
daniel1
daniel1OP3y ago
so i can name just one intger i thought i had to name two
Servator
Servator3y ago
@daniel1 Just loop around 10 students get their answer with Console.ReadLine() or Console.ReadKey() Count them after you can switch to 200
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
daniel1
daniel1OP3y ago
i dont get it class Program { static void Main(string[] args) { int answer,yes=0,no=0; for (int i = 0, i<= 200; i++) { Console.WriteLine("enter yes or no"); answer = int.Parse(Console.ReadLine()); if (answer = y) { yes++; } } } } } whats am i doing wrong class Program { static void Main(string[] args) { Double answer; int yes=0,no=0; for (int i = 0; i<= 200; i++) { Console.WriteLine("enter yes or no"); answer = int.Parse(Console.ReadLine()); if (answer = y) { yes++; } } } } tried this too still its giving me red on the y
ero
ero3y ago
lots of things. do the Hello World course, or listen to your teachers (i have to assume you were taught this) read the errors don't make us guess them
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server