Hello, so i am having a logical error i cant seem to store and incrament the questions variable
Program Specifications The human resources department has asked you to write a program that grades the candidate’s technical skills. The exam has 20 multiple choice questions. Here are the correct answers: 1. E 2. D 3. D 4. B 5. A 6. C 7. E 8. B 9. D 10. C 11. D 12. A 13. A 14. D 15. E 16. E 17. A 18. E 19. A 20. D A candidate must correctly answer 15 out of 20 questions to pass the exam and advance to the next level of interviews. The exam questions are printed on paper and the candidate enters their answers to the questions using the program you write. After the candidate enter all the answers to the questions, the program will either display a message indicating that they passed the exam and the total number of correct answers or a message indicating that they failed the exam and the total number of incorrect answers and the list of question numbers that the candidate answered incorrectly.
Sample data Expected result
Passed with 20 correct answers.
Passed with 15 correct answers.
Failed with 10 incorrect answers. Incorrect questions: 6, 7, 8, 9, 10, 16, 17, 18, 19, 20 if i need to make alterations to my code/ questions please LET ME KNOW, i will try and make it readable as possible
Thank you
What I have tried:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CPSC1012_CorePortfolioAssignment3_EmilyJohnson
{
class Program
{
static void Main(string[] args)
{
char[] anwserKey = { 'E', 'D', 'D', 'B', 'A', 'C', 'E', 'B', 'D', 'C', 'D', 'A', 'A', 'D', 'E', 'E', 'A', 'E', 'A', 'D' };
char anwser;
int[] questions = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
int correct = 0;
int incorrect = 0;
int question = questions.Length;
int wrong = 0;
for (int i = 0; i < questions.Length; i++)
{
question = i + 1;
Console.Write("{0}: ", question);
anwser = char.Parse(Console.ReadLine().ToUpper());
if (anwser == anwserKey[i])
{
correct++;
}
else
{
incorrect++;
if(anwser != anwserKey[i])
{
questions[i] = i + 1;
question = questions[i];
}
}
}
if (correct >= 15)
{
Console.WriteLine("Passes! you got {0} questions correct", correct);
}
else
{
Console.WriteLine("Failed! you got {0} questions wrong", incorrect);
Console.WriteLine("Incorrect Question: ");
for (int n = 0; n < questions.Length; n++)
{
Console.Write("{0} ", questions[incorrect]);
}
} Console.ReadLine();
}
}
}