Help with quiz program
Published: 2020-02-03 02:07:05

I am writing a quiz program and I am at a point that I don't know what to do. Below are the requirements for my assignment. I need help to point me in the correct direction on what I need to do.

Implement a loop option that suits your project. The goal is to cycle through all questions in a first round and read the appropriate user’s input from the console.
Mark whether the input is the correct answer.
Cycle through all incorrectly answered questions in a second round. 
Tally the results and display the number of correct/incorrect answered questions, at the end.
Test the code for different input values of the variable(s) including out-of-range values and adding a statement displaying an error message.
Document a successful run of the program.

Here is my code.

using System;

namespace Checkpoint3ClayBradley
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = "Bradley Clay";
            Console.WriteLine(a);
            var b = "Engineering 115: Introduction to Computing for Engineers";
            Console.WriteLine(b);
            var c = "Course Project: Checkpoint 2 Quiz Programming Project";
            Console.WriteLine(c);
            Console.WriteLine("Fluorescent Penetrant Level II Quiz");
            Console.WriteLine("Press any key to begin the quiz.");
            Console.ReadKey();
            string First;
            int score = 0;
            int correct = 0;
            int incorrect = 0;
            int round = 1;
            string Second;
            string Third;
            string Fourth;
            string Fifth;
            string Sixth;
            string Seventh;
            string Eighth;
            string Nineth;
            string Tenth;

            Console.Clear();

            while (score == 0)
            {
                //First question
                Console.WriteLine("Question 1: \nWhich of the following is an advantage of FPI? " +
                    "\n A. Large areas can be inspected \n B. Parts with complex shape can be inspected " +
                    "\n C. It is portable \n D. All of the above");
                First = Console.ReadLine();


                switch (First.ToUpper()) //accept lowercase inputs
                {
                    case "D": Console.WriteLine("You answered D. \nYour answer is correct!");
                        correct = correct++;
                        flag = 1;  break;
                    case "A": case "B": case "C": Console.WriteLine("You answered " + First.ToUpper() + ". \nYour answer is incorrect");
                        incorrect = incorrect++;  break; //same logic
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }

                if (First.ToUpper() == "D")
                {
                    score = score + 10;
                    Console.WriteLine("\nScore:" + score + "\n"); break;
                }
                else
                {
                    Console.WriteLine("\nScore:" + score + "\n"); break;
                }

            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score !=20)
            {
                //Second question
                Console.WriteLine("Question 2: \nWhich type of penetrant is fluorescent penetrant? " +
                    "\n A. Type I \n B. Type II \n C. Type III \n D. Type IV");
                Second = Console.ReadLine();

                switch (Second.ToUpper()) //accept lowercase inputs
                {
                    case "A": Console.Write("Your answer is correct!"); break;
                    case "B": case "C": case "D": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Second.ToUpper() == "A")
                {
                    score = score + 10;
                    Console.WriteLine("\nScore:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("\nScore:" + score + "\n");
                }

            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 30)
            {
                //Third question
                Console.WriteLine("Question 3: \nWhich method of penetrant removal is water washable? " +
                    "\n A. Method A \n B. Method B \n C. Method C \n D. Method D");
                Third = Console.ReadLine();

                switch (Third.ToUpper()) //accept lowercase inputs
                {
                    case "A": Console.Write("Your answer is correct!"); break;
                    case "B": case "C": case "D": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Third.ToUpper() == "A")
                {
                    score = score + 10;
                    Console.WriteLine("\nScore:" + score + "\n");
                }
                else
                {
                    Console.WriteLine("\nScore:" + score + "\n");
                }

                if (Third.ToUpper() == "A")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 40)
            {
                //Fourth question
                Console.WriteLine("Question 4: \nWhich developer form is used for nonaqueous Type I developer? " +
                    "\n A. form a \n B. form b \n C. form c \n D. form d");
                Fourth = Console.ReadLine();

                switch (Fourth.ToUpper()) //accept lowercase inputs
                {
                    case "D": Console.Write("Your answer is correct!"); break;
                    case "A": case "B": case "C": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Fourth.ToUpper() == "D")
                {
                    score = score + 10;
                    Console.WriteLine("\nScore:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("Wrong!\n" + " score:" + score + "\n");
                }
                if (Fourth.ToUpper() == "D")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 50)
            {
                //Fifth question
                Console.WriteLine("Question 5: \nWhich of the following discontinuities can be found by the penetrant test method? " +
                    "\n A. A surface crack \n B. A subsurface crack \n C. An internal inclusion \n D. None of the above");
                Fifth = Console.ReadLine();

                switch (Fifth.ToUpper()) //accept lowercase inputs
                {
                    case "A": Console.Write("Your answer is correct!"); break;
                    case "B": case "C": case "D": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Fifth.ToUpper() == "A")
                {
                    score = score + 10;
                    Console.WriteLine("\nScore:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("\nScore:" + score + "\n");
                }
                if (Fifth.ToUpper() == "A")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 60)
            {
                //Sixth question
                Console.WriteLine("Question 6: \nThe term used to define the period of time in which the test part is covered with penetrant is: " +
                    "\n A. waiting time \n B. soak time \n C. dwell time \n D. bleed-in-time");
                Sixth = Console.ReadLine();

                switch (Sixth.ToUpper()) //accept lowercase inputs
                {
                    case "C": Console.Write("Your answer is correct!"); break;
                    case "A": case "B": case "D": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Sixth.ToUpper() == "C")
                {
                    score = score + 10;
                    Console.WriteLine("Correct!\n" + " score:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("Wrong!\n" + " score:" + score + "\n");
                }
                if (Sixth.ToUpper() == "C")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 70)
            {
                //Seventh question
                Console.WriteLine("Question 7: \nUsually, the most desirable method of removing excess water-washable penetrant after the dwell time is by: " +
                    "\n A. a low pressure coarse water spray \n B. water and brush \n C. a solid stream of water \n D. water and clean rags");
                Seventh = Console.ReadLine();

                switch (Seventh.ToUpper()) //accept lowercase inputs
                {
                    case "A": Console.Write("Your answer is correct!"); break;
                    case "B": case "C": case "D": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Seventh.ToUpper() == "A")
                {
                    score = score + 10;
                    Console.WriteLine("Correct!\n" + " score:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("Wrong!\n" + " score:" + score + "\n");
                }
                if (Seventh.ToUpper() == "A")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 80)
            {
                //Eighth question
                Console.WriteLine("Question 8: \nWhich of the following discontinuities is most likely to be missed due to improper rinse techniques? " +
                    "\n A. Forging laps \n B. Deep pitting \n C. Shallow and broad discontinuities \n D. The rinse technique will not affect the detection of discontinuities");
                Eighth = Console.ReadLine();

                switch (Eighth.ToUpper()) //accept lowercase inputs
                {
                    case "C": Console.Write("Your answer is correct!"); break;
                    case "A": case "B": case "D": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Eighth.ToUpper() == "C")
                {
                    score = score + 10;
                    Console.WriteLine("\nCorrect!\n" + " score:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("\nWrong!\n" + " score:" + score + "\n");
                }
                if (Eighth.ToUpper() == "C")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 90)
            {
                //Nineth question
                Console.WriteLine("Question 9: \nCapillary action is the tendancy of certain liquids to penetrate into small openings such as cracks or fissures. " +
                    "\n A. True \n B. False");
                Nineth = Console.ReadLine();

                switch (Nineth.ToUpper()) //accept lowercase inputs
                {
                    case "A": Console.Write("Your answer is correct!"); break;
                    case "B": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Nineth.ToUpper() == "A")
                {
                    score = score + 10;
                    Console.WriteLine("Correct!\n" + " score:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("Wrong!\n" + " score:" + score + "\n");
                }

                if (Nineth.ToUpper() == "A")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
            Console.Clear();

            while (score != 100)
            {
                //Tenth question
                Console.WriteLine("Question 10: \nThe terms dry, aqueous, and nonaqueous are used to describe cleaners" +
                    "\n A. True \n B. False");
                Tenth = Console.ReadLine();

                switch (Tenth.ToUpper()) //accept lowercase inputs
                {
                    case "B": Console.Write("Your answer is correct!"); break;
                    case "A": Console.WriteLine("Your answer is incorrect."); break;
                    default: Console.WriteLine("You did not enter a correct answer."); break;
                }
                if (Tenth.ToUpper() == "B")
                {
                    score = score + 10;
                    Console.WriteLine("Correct!\n" + " score:" + score + "\n");
                }
                else

                {
                    Console.WriteLine("Wrong!\n" + " score:" + score + "\n");
                }
                if (Tenth.ToUpper() == "A")
                {
                    correct = correct++;
                }
                else
                {
                    incorrect = incorrect++;
                }
                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
                Console.Clear();

            }
            while (score >= 100)
                Console.WriteLine("You have answered" + incorrect + "questions incorrect. \nYou will be given one additional chance to answer correctly." +
                  "\nPress anykey to being second round.");
            if (round == 1)
            {

            }
        }
    }
}