Question: If you could please tweek this code a bit and provide explanations of the data types that would be great! I am using Microsoft Visual

 If you could please tweek this code a bit and provide

If you could please tweek this code a bit and provide explanations of the data types that would be great! I am using Microsoft Visual Studio 2017 C# Here is the code:

using System;

namespace Checkpoint_2 { class Program { //Method that returns questions string getQuestions(int i) { string[] questions = { "1. Which mathematician's principle of fluid dynamics is the most widely taught explanation of how planes fly?", "2. Movement of the plane about the vertical axis of motion is called?", "3. When the pilot moves the wheel on the control/yoke to the left the result will be?", "4. VOR stands for Variable Oscillation Radar.", "5. Where on the aircraft would you find the green navigation light?", "6. In aviation, ILS stands for Instrument Landing System.", "7. What is the purpose of an aircrafts altimeter?", "8. The four main forces acting on an air plane are: lift, drag, thrust and weight.", "9. VFR stands for Vehicle Flight Recorder.", "10. In aviation, what is FOD?" }; // will be questions used on test. 6 Multiple choice and 4 true/false

return questions[i]; }

//Method that returns answers string getAnswers(int i) { string[] answers = { "a. Albert Einstein b. Plato c. Bill Smith d. Daniel Bernoulli", "a. Bank b. Yaw c. Pitch d. Flight", "a. The elevator goes up b. The right aileron goes up and the left aileron goes down c. The left aileron goes up and the right aileron goes down d. Both ailerons go down", "true false", "a. Left Wingtip b. Above the Cockpit c. Right Wingtip d. Tail", "true false", "a. To show the aircrafts airspeed b. To show the aircrafts angle of attack c. To show the aircrafts engine temperature d. To show the aircrafts altitude", "true false", "true false", "a. Fire Oppression Device b. Foreign Object Debris c. Foul Odor Detector d. First Officers Den", }; // these will stand as answer bank for all questions

return answers[i]; }

//Method that returns correct answers string getCorrectAnswers(int i) { string[] correctanswer = { "d", "b", "c", "false", "c", "true", "d", "true", "false", "b" }; //these are the correct answers to all the question. any other selections will be counted as incorrect

return correctanswer[i]; }

//Validates the input Boolean validateInput(string answer, string correctAnswer) { //For true/false questions if (correctAnswer.Equals("true") || correctAnswer.Equals("false")) { if (answer.Equals("true") || answer.Equals("false")) { return true; } else { Console.WriteLine(" Invalid Answer!!! Answer as either True/False... "); return false; } } else { if (answer.Equals("a") || answer.Equals("b") || answer.Equals("c") || answer.Equals("d")) { return true; } else { Console.WriteLine(" Invalid Answer!!! Answer as either a/b/c/d... "); return false; } } }

//Game int playGame() { //Variables int scoreCard = 0; // everyone starts with 0 correct out of ten. once quiz is completed score will be listed as 1-10.

int[] questionsIncorrect = new int[10];

Console.WriteLine(); int j = -1; string check;

Console.WriteLine("Attempt No 1"); for (int i = 0; i

//Validating answer while (validateInput(check, getCorrectAnswers(i)) == false) { //Re-reading check = Console.ReadLine(); }

Console.WriteLine(); if (check.Equals(getCorrectAnswers(i))) { scoreCard = scoreCard + 1; } else { j++;

questionsIncorrect[j] = i; } } int k; if (j > -1) { Console.WriteLine("Attempt No 2"); for (int i = 0; i

//Validating answer while (validateInput(check, getCorrectAnswers(k)) == false) { //Re-reading check = Console.ReadLine(); }

Console.WriteLine(); if (check.Equals(getCorrectAnswers(k))) { scoreCard = scoreCard + 1; } else { System.Console.WriteLine("Correct Answer is {0}", getCorrectAnswers(k)); } } }

return scoreCard; }

//Main method static void Main(string[] args) { Console.WriteLine("General Aviation Quiz");

//Welcome To Program Console.WriteLine("James Fox, ENGR115- General Aviation Quiz");

//Creating object Program p = new Program();

Console.WriteLine("Score is {0}", p.playGame()); Console.ReadKey(); }

}

}

This week, you may find it necessary to revise the data structure(s) in your project. Depending on the characteristics of the questions chosen for the project, arrays may or may not be a good fit. Examine the advantages and disadvantages of the data types you have learned so far in connection with your project. Document all findings fully as this is also an integral part of program development. You will continue working on this part of the project in this module and during Modules 7 and 8. By the end of week 8, your C# program should be fully coded and tested. It is suggested you plan time in advance to test your program

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!