Game Programming Week 3
Exam
Part A - Using If-Else If
Structures
IMPORTANT
PROJECT REQUIREMENTS:
·
Be sure that you've included a proper documentation comment at the
top of your source code.
·
Be sure that you've included proper code comments throughout your
source code, explaining the code.
·
Be sure that you've properly commented any functions.
·
Be sure to write a STAIR document
1. For this
part of the exam, you will create a simple math game. Begin the game by asking
your user (via a prompt window) if they want to play a math game. If the user
answers "YES," you'll continue the game. If the user answers anything
other than "YES," thank them for playing and end the game. To test
the user's answer, use a single-alternative if structure.
2. If the
user answered "YES" to the question from Step #1, then you'll need to
ask the user three more questions: (a) Prompt the user for an integer number;
(b) Prompt the user for an arithmetic operator (+ for addition, - for
subtraction, * for multiplicaton or / for division);
(c) Prompt the user for another integer number. You may assume the user is smart enough to enter a number, when
prompted to do so. However, use an if-else if structure to determine which operation
your program should perform on the numbers. Be sure to include an else branch
at the end of your if-else if structure to handle an incorrectly entered
operator (something other than +, -, * or /).
3. Return a
message to the user telling them the result of the operation (something like
"4+3=7") and then end the program with a message thanking them for
playing.
4. Save your
lab as DecisionStructuresExamA.html. (IMPORTANT: Do NOT change this filename, type it EXACTLY as
you see it. If you change the filename, we will give you no credit for this part
of the exam!)
5. Post your
exam to your hightechacademy.net/websites directory, saving it with the
following path:
/[your folder
name]/exams/DecisionStructuresExamA.html
Part B - Switch-Case
Structures
IMPORTANT
PROJECT REQUIREMENTS:
·
Be sure that you've included a proper documentation comment at the
top of your source code.
·
Be sure that you've included proper code comments throughout your
source code, explaining the code.
·
Be sure that you've properly commented any functions.
·
Be sure to write a STAIR document.
1. For this
part of the exam, you re-create the simple math game that you programmed
previously, but this time you'll use switch-case structures. Begin the game
just like you did in the previous lab section, by asking your user (via a
prompt window) if they want to play a math game. If the user answers
"YES," you'll continue the game. If the user answers anything other
than "YES," thank them for playing and end the game. To test the
user's answer, use a single-alternative if structure.
2. If the
user answered "YES" to the question from Step #1, then you'll need to
ask the user three more questions: (a) Prompt the user for an integer number;
(b) Prompt the user for an arithmetic operator (+ for addition, - for
subtraction, * for multiplication or / for division); (c) Prompt the user for
another integer number. You may assume the user is
smart enough to enter a number, when prompted to do so. However,
use a switch-case structure to determine which operation your program should
perform on the numbers. Be sure to include an default
case at the end of your structure to handle an incorrectly entered operator
(something other than +, -, * or /).
3. Return a
message to the user telling them the result of the operation (something like
"4+3=7") and then end the program with a message thanking them for
playing.
4. Save your
lab as DecisionStructuresExamB.html. (IMPORTANT: Do NOT change this filename, type it EXACTLY as
you see it. If you change the filename, we will give you no credit for this
lab!)
5. Post your
lab to your Pegasus directory, saving it with the following path:
/[your folder name]/exams/DecisionStructuresExamA.html
6.
Part C - Submit
IMPORTANT PROJECT REQUIREMENTS:
·
Be sure that you've included a proper subject.
·
Be sure that you have included valid links.
·
Be sure to complete before September 2
Your email
subject MUST be Game Programming Week 3 Exam The body of your email should contain
the stair documents for Part A and Part B and be clearly marked. Links to your
code for Part A and B must also be included.
This must
be received no later than 11:59 pm on September 1.