ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 9.00

Assignment 4 Strings and Functions

Can someone Only use two strings without array solve this code? Also, do not use global variables. Follow the requirement. 

 

 

Assignment 4
Strings and Functions
Due: Sunday, February 19, 2017 11:59pm
(90 pts) Problem Statement: Wheel of Fortune
You will implement the program for playing a modified Wheel of Fortune. The game must allow
a user to enter the number of rounds to play and a new secret message (possibly containing
blanks) with each round, and print the number of dashes/slots for the message (spaces do not
get dashes, just the space).
If you are not familiar with the game of Wheel of Fortune, then you can watch an episode on
YouTube: https://www.youtube.com/watch?v=A8bZUXi7zDE
NOTE: I realize there are solutions to assignments online, but resist the temptation of using
these because the assignments are checked against online resources, code submitted by
classmates, and code submitted by prior students for cheating/plagiarism. It is much more
gratifying to complete this on your own. Make sure you take time to design well!!!
The game can play with 1-3 players, and it continues a round, until someone solves the puzzle
correctly. A new puzzle is given with each round. In this Wheel of Fortune, you won’t win as
much or any prizes, but you might go bankrupt or lose a turn!!! Your random numbers are only
from 0-21, with 0 being bankrupt, 1-20 being the dollar amount earned per letter found in the
puzzle, and 21 is lose a turn.
The game begins by asking the first player if he/she wants to spin the wheel, buy a vowel, or
solve the puzzle. On a player’s first turn, it might not make sense to choose anything other than
spinning the wheel, but a player is given these three choices at all times during their turn, until
they guess an incorrect non-vowel letter, incorrectly solve the puzzle, or spin a 0 or 21.
If the player chooses to spin and the spin is >0 and <21, then the player is asked to guess a
non-vowel letter. If the non-vowel letter was not found in the puzzle, then the player loses their
turn to the next player. If the non-vowel letter is found in the puzzle, then the player wins the
number of letters found times (*) the dollar amount spun.
If a player spins a 0, then the player’s earnings go to a zero in that round, and the next player
gets the three choices to spin the wheel, solve the puzzle, or buy a vowel. If a player spins a
21, then the player’s keeps the round earnings, but the next player gets the three choices to
spin the wheel, solve the puzzle, or buy a vowel.
If a player chooses to solve the puzzle and does so correctly, then the player gets to keep all
the money earned in that round, while all other players lose their money in that round. If a
player chooses to solve the puzzle and does so incorrectly, then the turn goes to the next
player.
A player can only buy a vowel when his/her earnings are >= $10, which is the one-time amount
paid for each vowel guess, regardless of whether the vowel is found.
The player who has the most money after N rounds is the winner!
A few rule specifics: You have a total round earnings and a total game earnings. You always get a choice of spinning the wheel, solving the puzzle, or buying a vowel
during your turn, buy you cannot buy a vowel if you have less than $10. You lose your turn by incorrectly guessing a non-vowel letter on a spin, spinning a 0 or
21, or incorrectly solving the puzzle. If you spin > 0 or <21, then you get the number spun times (*) the number of non-vowel
letters found added to your round total.
If you spin a 0, then you go bankrupt in the round (lose your round total), and it ends
your turn.
If you spin a 21, then you keep your round total, but it ends your turn.
You can buy a vowel for $10, and you only pay the $10 vowel purchase once on a
guess, independent of how many are found.
If you solve the puzzle correctly, then you keep the money earned for that round and add
it to your total game earnings.
You win the game by having the most game earnings, not round earnings!!! Your program must print out 1) the number spun on the wheel,2) the number of letters found for
a guess, 3) the total round earnings, 4) the message with the correctly guessed slots and blank
slots, 5) if the user guesses the message, then a winner message and the total game earnings
for all players, and 6) after all rounds are played, a message with the winning player.
Program Requirements: Only use C++ strings, no need for an array! Hint: use two strings! Your program must ignore cases in the message. Each function, including main, may not have more than 15 lines of code (this doesn’t include
curly braces, variable declarations, comments, and blank spaces!). You are not allowed to use global variables.
Read the C++ string documentation to help with this assignment:
http://www.cplusplus.com/reference/string/string/?kw=string
**You can decide how many incorrect guesses a user gets before they lose. In addition, you can
use the system(“clear”); command from the <cstdlib> to clear the screen, after the user enters
their message. Yes they can scroll above to see the message, but we aren’t cheaters!!!
Example Run:
Enter a message: National Park Service
How many players do you have? 2
How many rounds for winning? 1
The message is _ _ _ _ _ _ _ _ ____ _______ Player 1:
Do you want to spin (1), solve the puzzle (2), or buy a vowel (3): 1
Your wheel landed on 20
Guess a letter: n
2 found. Total: $40
The message is N _ _ _ _ n _ _ ____ _______ Do you want to spin (1), solve the puzzle (2), or buy a vowel (3): 1
Your wheel landed on 10
Guess a letter: l
1 found. Total: $50
The message is N _ _ _ _ n _ l ____ _______ Do you want to spin (1), solve the puzzle (2), or buy a vowel (3): 3
Guess a vowel: a
3 found. Total: $40
The message is N a _ _ _ n a l _ a _ _ _ _ _ _ _ _ _ Do you want to spin (1), solve the puzzle (2), or buy a vowel (3): 1
Your wheel landed on 0
Total: $0
The message is N a _ _ _ n a l _a__ _______ Player 2:
Do you want to spin (1), solve the puzzle (2), or buy a vowel (3): 1
Your wheel landed on 5
Guess a letter: r
2 found. Total: $10
The message is N a _ _ _ n a l _ar_ __r____ Do you want to spin (1), solve the puzzle (2), or buy a vowel (3): 1
Your wheel landed on 10
Guess a letter: t
1 found. Total: $20
The message is N a t _ _ n a l _ar_ __r____ Do you want to spin (1), solve the puzzle (2), or buy a vowel (3): 2
Guess message: National Park Service
You are correct! Player 2 wins round 1.
Player 1 total: $0
Player 2 total: $20
Player 2 wins game!
(10 pts) Extra Credit Error Handling
Make it so that your program never errors on users input! Handle the following errors: The user enters a message or letter outside of A-Z and a-z. The user enters an invalid menu choice. The user enters a vowel for a non-vowel guess. The user enters a non-vowel for a vowel guess.
(-10 pts) Automatic Deduction: You are not allowed to use global variables in any assignment
in CS 161. There isn’t any practical purpose for them in this course. Keep this in mind as you
design your program with functions.
(10 pts) Program Style/Comments
In your implementation, make sure that you include a program header in your program, in
addition to proper indentation/spacing and other comments! Below is an example header to
include. Make sure you review the style guidelines for this class, and begin trying to follow
them, i.e. don’t align everything on the left or put everything on one line!
http://classes.engr.oregonstate.edu/eecs/winter2017/cs161-001/161_style_guideline.pdf
You are graded on having a header, function headers with pre/post conditions, proper
comments, and readable code with indentation and vertical spacing that is CONSISTENT
throughout your program. DO NOT align your entire program on the left side. This will cause
you to automatically lose the full 10 points. In addition, do not forget your program header!!!
Electronically submit your C++ program (.cpp file, not your executable!!!) by the assignment due
date, using TEACH.

Attachments:

Answers

(11)
Status NEW Posted 02 May 2017 09:05 AM My Price 9.00

-----------

Attachments

file 1493716283-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)