Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C# C# code for Increment of number by button click

Greetings,

I am looking for assistance in getting the code for the following questions. Please advise as to which controls will be used for each as well.

1). Write a program that initially displays the number 1 in a label. Clicking a button should increment the value. Make use of an instance variable initialized to 1, and set up the label in the constructor. [Note: Do not set the label’s Text property to 1 in the Properties Window at design-time.]

2). Write a program that produces a random number between 200 and 400 each time a button is clicked. The program should display this number, and the sum and average of all the numbers so far. As you click again and again, the average should converge on 300. If it doesn’t, we would suspect the random number generator – just as we would be suspicious of a coin that came out heads 100 times in a row! [Note: Do not create more than one instance of the Random class.]

3). Betting. A group of people are betting on the outcome of three throws of the dice. A person bets R10 on predicting the outcome of the three throws. Write a program that uses the random number method to simulate three throws of a die and displays the winnings according to the following rules: • All three throws are sixes: win R200; • All three throws are the same (but not sixes): win R100; • Any two of the three throws are the same: win R50. Additional notes: • Do not create a Random object more than once. • Do not use more than three if statements
 
Just expecting to be "getting the code" is not going to bring you any further. Have you actually tried anything yet ? Like installing Visual Studio and creating a form with a label and a button ? I don't understand why you should be asking what controls to use, assignment 1 practically spells it out for you.
 
Back
Top Bottom