DUE DATE: < Listed In Course Schedule >
You are not allowed to work in groups this assignment. For this assignment, you should start, finish, and do all the work on your own. If you have questions, please contact the instructor.
|
Learning Objectives:
(This is a list of the major topics that you, as
students, will learn in this
assignment:)
Please note that this assignment consists of two parts - part #1 is mostly coding, and part #2 (below) is entirely written. Make sure to do both!
For this assignment, you will write part of a simple, Console-based program that will quiz you (and anyone else who uses it) on the use of several operators (including the the modulus, or 'remainder', operator) in computer programming languages, such as C#.
The basic idea behind the program is that it will randomly generate two numbers (within a range that the user selects), and then ask the user what the answer is, when you apply some operator. If the user types in the correct answer, the program will congratulate the user. If the user types in the wrong answer, the program will encouragingly inform the user that the answer is not correct, and will then inform the user of what the correct answer is. This process (having the program pick two numbers randomly, and then asking the user the result of doing A % B, or A + B, or A * B, etc) should be repeated a number of times (how many is chosen by the user).
Four example transcripts of how the program works appears below your program's output should be the same, but can differ in whitespace (i.e., it should look exactly identical to what's below, except for maybe an extra space, or a missing space). User input is given in bold. Make sure that you display the correct operator in your output! (For example: "What is the result of 92 % 44?" vs. "What is the result of 92 + 44?") Also - make sure that you implement the fourth quiz option, which is a bit different than the first three (the first three use only one operator, but the last option uses two - first integer division, then the modulus operator.
Welcome to The Quiz Program! Press the 'Return' key to exit
|
Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 2 I will ask you to tell me the result of A * B What is the smallest value of A: 0 What is the largest value of A: 100 What is the smallest value of B: 40 What is the largest value of B: 50 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of 45 * 41? 1845 1845 is correct! What is the result of 14 * 50? 200 Good try, but no: 14 * 50 = 700 What is the result of 81 * 40? 200 Good try, but no: 81 * 40 = 3240 Thank you for using this program - have a nice day! Press the 'Return' key to exit |
Welcome to The Quiz Program!
|
Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 4 You need to type in a number that is 4 or less: I will ask you to tell me the result of (A / B ) % C (integer division, then modulus) What is the smallest value of A: 10 What is the largest value of A: 20 What is the smallest value of B: 10 What is the largest value of B: 20 What is the smallest value of C: 1 What is the largest value of C: 5 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of (12 / 15) % 3? 0 0 is correct! What is the result of (15 / 18) % 1? 0 0 is correct! What is the result of (17 / 10) % 2? 10 Good try, but no: (17 / 10) % 2 = 1 Thank you for using this program - have a nice day! Press the 'Return' key to exit |
Your job for this assignment is to implement this program in C#.
As a final note, there are three major objectives for this assignment
For the student to learn more about operators (including the
modulus operator, and the 'integer division' aspect of the division operator)
and to make sure that each student is comfortable using conditional statements, specifically:
A series of basic if statements
A series of if...else statements
A single switch statement.
In order to receive full credit for this assignment, you need to implement all three versions of this solution, which is explained in greater detail in comments, in the source code for the assignment (in the file Program.cs - from lines 270 through 318)
and to start getting used to reading through other peoples' programs, and to
modify or build on the existing code instead of writing everything from
scratch.
In order to achieve this you need to first skim / read
through the existing code in order to get a handle on what the program
already does, and to then extend that program by adding your code to the
sections marked
// STUDENTS: YOUR SOLUTION
USING 'XXXXXXXXXX' SHOULD START HERE //
(Where 'XXXXXXXXXX' is
replaced with the specific stuff you should be worked on)
You need to write up your answers to the following questions, and store those answers in any format the instructor can read. A Microsoft Word document is fine, text is fine, HTML is fine, PDF is fine. For anything else, ask first. Clearly, the program you're writing for this assignment may be helpful in answering these questions, but if you do them 'by hand' (or rather, 'by mind'), that's great, too.
It is expected that you will be develop an understanding of the modulus operator in part by utilizing the completed program. While the instructor isn't able to actually check, you should understand that it is a requirement of this assignment that you use your completed program to do just this - play around with it, try different combinations of range, etc, etc.
For all of the following questions, assume that you're working with the equation
A % B = C.
For each question, clearly and concisely state your answer, as well as an intuitive, easy-to-understand explanation explaining why you always get the answer that you do. Imagine that you're trying to explain this to someone who neither programs, nor does much math.
1.
When A is less than B, what will C be?
2. When A is == B, what will C be?
You are not allowed to work in groups for this assignment. You should start, finish, and do all the work on your own. If you have questions, please contact the instructor.
Additionally, you should aggressively comment your code, paying particular attention to areas that are difficult to understand. If you found something to be tricky when you wrote it, make sure to comment it so that the next person (the instructor, who's grading you) understands what your code is doing. It is not necessary to comment every single line.
The purpose of new requirement is to both help you understand, and have you demonstrate, a thorough understanding of exactly how your program works.
Every file that you turn in should have:
·
At the top of each file that
you normally edit, you should put your name (first and last), the name of this
class (BIT 142), and the year and quarter, and the assignment number,
including the revision number, which starts at 0 (A1.0). If youre handing
this in again for a regrade, make sure to increase the minor version number by
one (from A1.0, to A1.1").
You normally edit the C# source code files (.CS files), and any Word documents
that you're handing in (if any).
You do not normally edit the .SLN or .CSPROJ files, and so you should not try to
put this identifying information in those files.
In general, you should make sure to do the following before handing in your project:
· All variables used should have meaningful names.
· The code should be formatted consistently, and in an easy to read format.
What to turn in:
· A single electronic folder (a directory). This folder should contain:
o
The source code for the
program all the .CS files in your project.
I would prefer that you include the project files stuff ending in .SLN and
.VCPROJ, so I can build your project more easily. If you can save these files
(the .SLN / . VCPROJ) into a file format that can be opened by VS.Net 2003, that
would be great.
o
You have to name the folder
with your last name, then first name, then the assignment number (both the major
version 2, and the minor (revision) number 0). Example: "Panitz, Mike,
A2.0"
·
You
should not include
the bin
or obj
directories, or anything from it. I will dock you a couple points if
you do.
How to electronically submit your homework:
There's a link on the homework page to the document that guides you through handing in your work.