Please excuse my noobness regarding this language, I am very much a beginner. I've been tasked with creating a Quiz Maker and I'm stuck on how I am supposed to put some of my class elements into a List. The reason I need to put these into a list is because I don't want to handle each user inputted answer separately, rather in a list and have everything dependant on the list size and set a limit for how many answers I want to store in it. Any help would be hugely appreciated.
Here is my class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Quiz_Maker
{
public class QuestionAndAnswers
{
public string userQuestion { get; set; }
List<string> QnAList = new List<string>();
public string falseAnswerOne { get; set; } //TODO: this could maybe perhaps possilby be a list of string
public string falseAnswerTwo { get; set; } //TODO: this could maybe perhaps possilby be a list of string
public string falseAnswerThree { get; set; } //TODO: this could maybe perhaps possilby be a list of string
public string correctAnswer { get; set; } //TODO: this could maybe perhaps possilby be a list of string
private int correctAnswerIndex;
}
}
Here is my object method:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Quiz_Maker
{
public static class UserInterface
{
public static QuestionAndAnswers GetQuestionAndAnswers()
{
QuestionAndAnswers UserQnA = new QuestionAndAnswers();
string userQuestion;
string correctAnswer;
string falseAnswerOne;
string falseAnswerTwo;
string falseAnswerThree;
Console.WriteLine("Please type your question: ");
UserQnA.userQuestion = Console.ReadLine();
Console.WriteLine("Please type the correct answer: ");
UserQnA.correctAnswer = Console.ReadLine();
Console.WriteLine("Please type your first false answer: ");
UserQnA.falseAnswerOne = Console.ReadLine();
Console.WriteLine("Please type your second false answer: ");
UserQnA.falseAnswerTwo = Console.ReadLine();
Console.WriteLine("Please type your third false answer: ");
UserQnA.falseAnswerThree = Console.ReadLine();
return UserQnA;
}
}
}
I've googled this topic to death and have not found anything that makes sense.