Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm using C#, trying to get this to loop the incorrect answers to give a second attempt and then give a score. using System; namespace

I'm using C#, trying to get this to loop the incorrect answers to give a second attempt and then give a score.

using System;

namespace FileName { class Program { public static void Main(string[] args) { String name = "My Name"; String courseName = "Course Name"; String assignmentName = "Assignment Name"; int answer; Console.WriteLine("Name: " + name); Console.WriteLine("Course Name: " + courseName); Console.WriteLine("Assignment Name: " + assignmentName); //used as a header to identify me, the course, and the assignement

Console.WriteLine(" Question 1: The blue whale is the largest mammal."); Console.WriteLine("1 = True 2 = False"); //Question 1 and answers

Console.WriteLine("Choose the correct answer"); //prompts user to answer question

answer = Convert.ToInt32(Console.ReadLine()); String correct_or_wrong = 1 == answer ? "Correct" : "Incorrect"; Console.WriteLine(correct_or_wrong); //lets user know if they were correct or incorrect

Console.WriteLine(" Question 2: What is the longest river in the world?"); Console.WriteLine("1 = Amazon River 2 = Nile River 3 = Congo River 4 = Yellow River"); //Question 2 and answers

Console.WriteLine("Choose the correct answer"); //prompts user to answer question

answer = Convert.ToInt32(Console.ReadLine()); correct_or_wrong = 2 == answer ? "Correct" : "Incorrect"; Console.WriteLine(correct_or_wrong); //lets user know if they were correct or incorrect

} } }

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

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

What five factors help determine if you have lost attention?

Answered: 1 week ago

Question

4-6 Is there a digital divide? If so, why does it matter?

Answered: 1 week ago