Create an Account

Already have account?

Forgot Your Password ?

Home / Questions / This module week, you will optimize the existing project code by using arrays. Think about putting a

This module week, you will optimize the existing project code by using arrays. Think about putting a

This module week, you will optimize the existing project code by using arrays. Think about putting all questions in one data array. Use loop techniques to cycle through all questions. Envisage the same for the answers. Foolproof the code by disallowing improper input values and display an error message while giving the user a chance to repeat the input. You will start to use methods for repetitive tasks, like checking for the correct answer. Document your test Below is my code so far. Any guidance will be greatly appreciated

class Program
{
static void Main(string[] args)
{   
Console.WriteLine("");
bool correct1 = false;
bool correct2 = false;
bool correct3 = false;
bool correct4 = false;
bool correct5 = false;
bool correct6 = false;
bool correct7 = false;
bool correct8 = false;
bool correct9 = false;
bool correct10 = false;

int amountcorrect = 0;
int amountincorrect = 10;

Console.WriteLine("Objective: Identify basic facts about the U-2S aircraft with a minimum accuracy of 80% ");
Console.WriteLine("");

Console.WriteLine("Instructions: Choose the correct letter for the corresponding answer, please use all lowercase");
Console.WriteLine("");
for (int i = 0; i
{
if (correct1 == false)
{
Console.WriteLine("Q1) True or False: Cadmium free tools must be used around titanium parts?");
Console.WriteLine("");
Console.WriteLine("A.True");
Console.WriteLine("B.False");
var Cadmium = Console.ReadLine()

if (Cadmium == "a")
{
correct1 = true;
amountcorrect = amountcorrect + 1;
amountincorrect = amountincorrect - 1;
Console.WriteLine("");
}
else if (Cadmium == "b")
{
correct1 = false;
Console.WriteLine("");
}
else
{
Console.WriteLine("Error!Invalid Input, please try again");
Cadmium = Console.ReadLine();
}
}
if (correct2 == false)
{
Console.WriteLine("Q2) The U-2S Aircraft landing gear is what configuration?");
Console.WriteLine("");
Console.WriteLine("A.Quadracycle");
Console.WriteLine("B.Unicycle");
Console.WriteLine("C.Bicycle ");
Console.WriteLine("D.Tricycle");
var Configuration = Console.ReadLine();

if (Configuration == "c")
{
correct2 = true;
amountcorrect = amountcorrect + 1;
amountincorrect = amountincorrect - 1;
Console.WriteLine("");

}
else if (Configuration == "a" || Configuration == "b" || Configuration == "d")
{
correct2 = false;
Console.WriteLine("");
}
else
{
Console.WriteLine("Error!Invalid Input, please try again");
Configuration = Console.ReadLine();
}
}
if (correct3 == false)
{
Console.WriteLine("Q3) How many engines are on the U-2S?");
Console.WriteLine("");
Console.WriteLine("A.4");
Console.WriteLine("B.3");
Console.WriteLine("C.2");
Console.WriteLine("D.1");
var Engine = Console.ReadLine();

if (Engine == "d")
{
correct3 = true;
amountcorrect = amountcorrect + 1;
amountincorrect = amountincorrect - 1;
Console.WriteLine("");
}
else if (Engine == "a" || Engine == "b" || Engine == "c")
{
correct3 = false;
Console.WriteLine("");
}
else
{
Console.WriteLine("Error!Invalid Input, please try again");
Engine = Console.ReadLine();
}
}
if (correct4 == false)
{
Console.WriteLine("Q4) True or False: The Aneroid Initiators fire at 30,000 ft?");
Console.WriteLine("");
Console.WriteLine("A.True");
Console.WriteLine("B.False");
var Aneroid = Console.ReadLine();

if (Aneroid == "b")
{
correct4 = true;
amountcorrect = amountcorrect + 1;
amountincorrect = amountincorrect - 1;
Console.WriteLine("");
}
else if (Aneroid == "a")
{
correct4 = false;
Console.WriteLine("");
}
else
{
Console.WriteLine("Error!Invalid Input, please try again");
Aneroid = Console.ReadLine();
}

Apr 02 2020 View more View Less

Answer (Solved)

question Subscribe To Get Solution

Related Questions