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
good luck!
"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
not a c# question, but y = yes and n = no
the students indicate yes or no to the questionnaire
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
Just random initialized list with bunch or 0 and 1's
104 student wants to go (1)
96 doesnt want (0)
what
what is this what are you doing
wtf i didnt see indicate y
part
-_-
what does var stand for
they literally just need to take console input and count the amount of yesses and nos
have you done literally any c# ever?
so i can name just one intger
i thought i had to name two
@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•3y ago
Message Not Public
Sign In & Join Server To View
Written interactive course https://learn.microsoft.com/en-us/users/dotnet/collections/yz26f8y64n7k07
Videos https://dotnet.microsoft.com/learn/videos
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
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•3y ago
Message Not Public
Sign In & Join Server To View