Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that will ask the user for their name. If the user does not input anything, display a warning before continuing. The program

Write a program that will ask the user for their name. If the user does not input anything, display a warning before continuing. The program will then ask the user whether they want to have an addition, subtraction, multiplication, or division problem. Once the user indicates their choice, the program will display 2 randomly generated whole numbers from 1 to 9 in a math problem matching the users choice.

Example: user selects addition, the equation presented is:

(random number from 1 to 9) + (random number from 1 to 9)

The user will then input an answer as a whole number. If the answer they entered is not a whole number, tell the user their input is invalid and end the program. If the input is valid, check to see if it is the correct answer. If correct, congratulate the user by name. If incorrect, output the correct answer.

Tasks

  1. The program needs to contain the following
    1. A comment header containing your name and a brief description of the program
    2. At least 5 comments besides the comment header explaining what your code does
    3. A string variable that captures the users name
    4. A way to validate user input to determine if they entered an empty string
      1. Warn the user if they enter an empty string
      2. Continue the program after warning the user
    5. A prompt for what type of quiz the user wants
    6. Display of a quiz matching the type the user requested
      1. Note: to avoid getting the same random number. Create one Random object and call .Next with it twice.
    7. A prompt for an answer in the form of a whole number
      1. A message if the user enters an invalid number
        1. Do not check the users answer if their input is invalid
      2. If input is valid:
        1. Check the answer
        2. If the answer is correct, congratulate the user by name
        3. If incorrect, output the correct answer
  2. Upload a completed .cs file onto the Assignment 4 submission folder and a word document containing the following six (6) screenshots:
    1. The warning displayed when the user enters a blank value for the name
    2. One test run for each equation with valid input
      1. Answer 2 quizzes correctly
      2. Answer 2 quizzes incorrectly
    3. One test run with invalid input

Please code in C#

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 Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

9. System creates a large, diverse talent pool.

Answered: 1 week ago