16,004,686 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 8349150 (Top 10 by date)
Member 8349150
6-Dec-11 21:00pm
View
I only set I =0 am I supposed to se it to something else?
Member 8349150
6-Dec-11 20:51pm
View
updated the question with the piggybank class
Member 8349150
6-Dec-11 20:42pm
View
Thank you very much for all the help but why does when I run my program it displays lets just say "Penny added" 100 times
Member 8349150
6-Dec-11 20:41pm
View
Thank you very much for all the help but why does when I run my program it displays lets just say "Penny added" 100 times
Member 8349150
6-Dec-11 20:25pm
View
thank you very much and how would I write the if statement for option 0
Member 8349150
21-Nov-11 23:43pm
View
High-Low Game
In the High-Low game, a player begins with a score of 1000 which can be used to wager on the results of a random number selection. The computer generates a random number between 1 and 13, and the player is asked to guess if the number is low (1-6) or high (8-13). Seven is considered neither high nor low, and is an automatic loss for the player. If the player guesses correctly, then the number of points wagered is doubled and added to the person’s original amount. The player is then asked if they want to play again. The game continues until either the player decides to quit, in which case a farewell message is printed with the player’s final points, or until the player has no points left. Your task is to create a HighLow Console application which implements this game. Output should reflect the following:
High Low Game!
Welcome to the Game!
RULES:
Numbers 1 through 6 are low.
Numbers 8 through 13 are high.
Number 7 is neither high nor low.
You have 1000 points.
Enter points to risk: 500
Predict (1=High, 0=Low): 0
The computer generated a 4.
You win!
Play again? (y/n) y
You have 2000 points.
The first step you need to take is to open HighLowTemplate.cs from the shared drive (s:\CSharp) and resave it into your directory with the name HighLow.cs. It has all of the methods that you will need to define. Here is a paste from the file:
/* Precondition: None
* This method prints out the welcome message and rules of the game.
* Postcondition: The message has been printed to the screen.
*/
static void printRules()
{
//Type code.
}
/* Precondition: numPoints is a valid integer
* getWager asks the player to enter their wager. It checks the validity of
* the wager (a valid wager cannot be less than zero nor can it be more
* points than the player currently has). The method then returns the valid
* wager.
* Postcondition: A valid wager is returned.
*/
static int getWager(int numPoints) {
//Type code
}
/* Precondition: None.
* getPrediction gets the player's prediction for high or low. The
* prediction must be either high (1) or low (0). Validity checks are done
* to ensure the prediction is within that range. Hence, a 0 or 1 is
* returned from the method.
* Postcondition: 0 or 1 is returned.
*/
static int getPrediction() {
//Type code
}
/* Precondition: thePrediction and num are valid integers
* isWin will return a boolean as to whether or not the player has won their
* bet. A win is defined as the following:
* if the player bet on low (0) and the number is less than 7, win is true
* if the player bet on high (1) and the number is greater than 7, win is
* true
* otherwise, win is false
*
* Postcondition: True is returned if the player has won; false is returned
* otherwise.
*/
static Boolean isWin(int thePrediction, int num) {
//Type code
}
/* Precondition: The game is over.
* finalMessage prints out 1 of two messages. One is if the player has no
* points left. A message indicating so is printed. Otherwise, the amount
* of points is printed to the screen, with a farewell message.
* Postcondition: A message indicating no points OR points remaining is
* printed to the screen.
*/
static void finalMessage(int thePoints)
{
//Type code
}
Member 8349150
21-Nov-11 19:34pm
View
I'm not going to sugar coat it I just have no idea how to finish it could you possibly guide me?
Member 8349150
31-Oct-11 15:41pm
View
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EvenandOdds
{
class Program
{
static void Main(string[] args)
{
int random;
List<double> even = new List<double>();
List<double> odd = new List<double>();
Console.Write("odd: ");
Random randomNums = new Random();
for (int randomm = 0; randomm < 25; randomm++)
{
odd.Add(randomNums.Next(0, 100));
bool isOdd = randomm % 2 != 0;
Console.WriteLine(odd[randomm].ToString());
Console.ReadLine();
}
}
}
}
Does not work too well but I tried what you said
Member 8349150
26-Oct-11 9:44am
View
I cannot even figure out where to start...can someone lead me onto what to do
Member 8349150
26-Oct-11 6:07am
View
No sorry I am not familiar I was absent for for loops and arrays
Show More