Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This week, you will create and implement an object-oriented programming design for your project. You will learn to identify and describe the classes, their attributes

This week, you will create and implement an object-oriented programming design for your project. You will learn to identify and describe the classes, their attributes and operations, as well as the relations between the classes. Create class diagrams using Visual Studio.

I need help with making a class diagram in visual studio 2017 C#.

Here is the code that I currently have.

namespace quiz { class Program { public Program() { }

static void Main(string[] args) { //Assignment name: //Console.WirteLine will diplay desire message Console.WriteLine("Assignment Name: Quiz, Programing Project "); //Name Console.WriteLine("Name: my name"); //Name of course Console.WriteLine("Course Name"); //Declaring Variables // " " provides new line of text or line breaks Console.WriteLine(" Welcome to the quiz!"); //questions

//Creating object Program p = new Program(); Console.WriteLine("Score is {0}", p.playQuiz()); Console.ReadKey(); } //Method that returns questions string getQuestions(int i)//each question will add up +1 to the interger "i" { string[] questions =//list of questions { "Q1. question", "Q2. question", "Q3.question", "Q4.question", "Q5. question?", "Q6. question", "Q7.question", "Q8. question", "Q9.question.", "Q10. question." }; return questions[i]; }

//Method that returns answers string getAnswers(int i)// will diplay with assign question at the same time { string[] answers = { "a. Option1 b. option2 c.option3 d.option4 ", "a. Option1 b. option2 c.option3 d.option4 ", "a. Option1 b. option2 c.option3 d.option4 ", "a. Option1 b. option2 c.option3 d.option4 ", "a. Option1 b. option2 c.option3 d.option4 ", "a. Option1 b. option2 c.option3 d.option4 ", "a.true b. false", "a.true b. false", "a.true a. false", "a.true a. false" }; return answers[i]; }

//Method that returns correct answers string getCorrectAnswers(int i)//correct answer to assigned question { string[] correctanswer = { "a", "c", "d", "a", "b", "c", "true", "false", "true", "true" }; return correctanswer[i]; }

//Validates the input Boolean validateInput(string answer, string correctAnswer) { if (correctAnswer.Equals("true") || correctAnswer.Equals("false"))// for multiple choice questions only input as "false" or "true" are valid { if (answer.Equals("true") || answer.Equals("false"))//assigned to true or falce question { return true; } else { Console.WriteLine(" Invalid Answer!!! Answer as either true/false... "); return false; } } 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, or d. ");//a, b, c, and d are the only valid inputs return false; } } int playQuiz() { //Variables int scoreCard = 0;// Displays the number of correct/incorrect answers during the second attempt.

int[] questionsIncorrect = new int[10];

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

Console.WriteLine("Attempt No 1"); for (int i = 0; i { System.Console.WriteLine("{0}", getQuestions(i));//"{0}" Will select an a question from the string assigned to int "i" System.Console.WriteLine("{0}", getAnswers(i));

check = Console.ReadLine();

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

Console.WriteLine(); if (check.Equals(getCorrectAnswers(i))) { scoreCard = scoreCard + 1;//question was correct, plus points } else { j++; questionsIncorrect[j] = i;//question one is correct then its true } }

int k;//the incorrect questions that will have a new int value if (j > -1) { Console.WriteLine("Attempt No 2"); for (int i = 0; i => { k = questionsIncorrect[i];

System.Console.WriteLine("{0}", getQuestions(k)); //display questions System.Console.WriteLine("{0}", getAnswers(k));//display answer options check = Console.ReadLine();

//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)); //in the second attempt, if answer is wrong, the correct answer will be shown } } } return scoreCard; } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Accounting

Authors: Robert Kemp, Jeffrey Waybright

2nd edition

978-0132771801, 9780132771580, 132771802, 132771586, 978-0133052152

Students also viewed these Programming questions

Question

Explain what human resource information systems are used for. P-96

Answered: 1 week ago

Question

Describe the importance of human resource planning. P-96

Answered: 1 week ago