Question: This program needs to be written in C#. I have written this so far and I cannot figure out what parts are wrong or what

This program needs to be written in C#. This program needs to be written in C#. I have written this

I have written this so far and I cannot figure out what parts are wrong or what needs to be fixed.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace quizz

{

class Program

{

static void Main(string[] args)

{

//List to hold wrong answers

List wrong_ques = new List();

//Variable to hold result

int result = 0;

//Hold Total no of question default is 10

int QuestionSize=10;

//Flag to check for attempt

bool IsFirstAttempt=true;

//Array to hold question, Type(how many options), Options,Answer

// You can place your questions here

string[,] ques = new string[,] {

{ "In which year did the B-2 Spirit have its first flight?", "4", "1985", "1989", "1990", "1993", "2" }, { "There were only 21 B-2 Bombers ever made.", "2", "TRUE", "FALSE", "", "", "1" }, { "The length of the B-2 Spirit is how many feet?", "4", "85", "75", "69", "63", "3" }, { "The height of the B-2 Spirit is 17 feet.", "2", "TRUE", "FALSE", "", "", "1" }, { "The wingspan of the B-2 Spirit is how many feet?", "4", "172", "189", "195", "197", "1" }, { "The B-2 Stealth Bomber has four engines.", "2", "TRUE", "FALSE", "", "", "1" }, { "The B-2 Bomber has a maximum takeoff weight of how many lbs?", "4", "220,000 lbs", "300,000 lbs", "376,000 lbs", "450,000 lbs", "3" }, { "The B-2 Spirit can fly at Mach 0.95.", "2", "TRUE", "FALSE", "", "", "1" }, { "The B-2 Bomber has a flight ceiling of how many feet?", "4", "30,000", "40,000", "47,000", "50,000", "4" }, { "The B-2 Spirit can hold up to 50,000 lbs of payload in its two internal bays.", "2", "TRUE", "FALSE", "", "", "1" }, };

//Goto label for if there is second attempt

SecondAttempt:

//Loop continued to question size

for(int i=0;i

{

//make console clear

Console.Clear();

//hold question no

int qid;

//if it is first attempt then continue question id as for loops i variable

if (IsFirstAttempt)

qid = i;

else

//else for second attemp go with wrong questions

qid = wrong_ques.ElementAt(i);

//Print question

Console.WriteLine("Q." + (i + 1) + ": " + ques[qid,0]);

//hold question type

string qtype = ques[qid, 1];

//Hold answer of question

string ans = ques[qid, 6];

//print options

Console.WriteLine("1. " + ques[qid, 2]);

Console.WriteLine("2. " + ques[qid, 3]);

//if qtype is 4 then continue to print remaining options

if (qtype == "4")

{

Console.WriteLine("3. " + ques[qid, 4]);

Console.WriteLine("4. " + ques[qid, 5]);

}

//Get user answer

Console.WriteLine("Enter Your Answer:");

string user_ans = Console.ReadLine();

//Match user answer with correct answer

if (user_ans != ans)

{

//if it is first attemp and wrong answer then add that question to wrong

//answer array list

if (IsFirstAttempt)

wrong_ques.Add(i);

else

{

//else print correct answer

Console.WriteLine("Sorry Correct answer is:" + ques[i, 6]);

Console.ReadLine();

}

}

else

//if answer is correct then increment result

result++;

}

//if wrong_ques contains any wrong answer then make attempt for again one time only

if(wrong_ques.Count>0 && IsFirstAttempt)

{

IsFirstAttempt = false;

QuestionSize = wrong_ques.Count;

Console.WriteLine("You have answered " + QuestionSize + " wrong answer press key to reattempt");

Console.ReadLine();

Console.Clear();

goto SecondAttempt;

}

else

//print result

Console.WriteLine("You Got " + result + " Out of 10 " );

Console.WriteLine("Press any key to exit...!");

Console.ReadLine();

}

}

}

Project Problem Write a "quiz" program on a topic, about which you are knowledgeable. This quiz can be work related, general knowledge or any set of questions where there is a specific answer. Ignore questions where long descriptions or general answers needed. The program should display the questions, one at a time, and possible answers, and accept an answer from the user. If the answer is correct, the program should go on to the next question. If it is incorrect, store the question for the second attempt and go on to the next question. When the list of questions has ended, the questions that were missed previously, or answered incorrectly, should be displayed again, in their original order. Keep a count of the correct answers for each category of questions and display the final count after two attempts. Also, display the correct answer, when necessary, in the second round of questioning. Limit the quiz to ten (10) questions. Include questions from both true/false and multiple-choice categories. Four (4) possible answers should be listed in multiple-choice questions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!