Trying to sort my quiz program into classes but I can't figure out how to initiate them and call there contents up later on in the code. I want to add my "questions" into their own class, then call them later on, and eventually do the same with my "answers & answer choices". I had to cut out some of the code to allow it to post in this forum. Any and all help is greatly appreciated!
namespace ConsoleApp3
{
class Questions
{
public Questions();
string[] questions = //question array
{
"1. What year is it in the opening scene of the movie?", //mult choice
"2. Peter Quill’s alias is “Star Prince”", //true false
};
public string[] Questions { get => questions; set => questions = value; }
}
class Program
{
private const bool V = false;
static void Main(string[] args)
{
int correct = 0;
int wrong = 0;
string quizTitle = "How well do you know the Guardians of the Galaxy?";
string prompt = "Please make a selection...";
string[] answerChoices = //answer choices array
{
" a. 1981\n b. 1988\n c. 1985\n d. 1990",
" a. True\n b. False",
};
string[] answers = //correct answer array
{
"b",
"b",
};
//array for flagging incorrect answers
bool[] redoQuestion =
{
false,
false,
}; //start of program
string input;
for (int x = 0; x < questions.Length; ++x) //for loop to ask & check questions for initial attempt
{
do
{ //checking for valid input
Console.WriteLine(Questions.ToString questions[x]);
Console.WriteLine(answerChoices[x]);
Console.WriteLine(prompt);
input = Console.ReadLine();
}