CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2009
    Posts
    1

    program code in vb

    any one help me to making those program ...............means help ma in coding..........?



    Deal a card Write a program with a single button on it which, when clicked, randomly selects a single playing card. First use the random number generator in the library to create a number in the range 1 to 4. Then convert the number to a suit (heart, diamond, club, spade). Next use the random number generator to create a random number in the range 1 to 13. Convert the number to an ace, 2, 3 etc. and finally display the value of the chosen card. (Hint: use Select as appropriate.)

    7.2 Sorting Write a program to input numbers from three track bars, or three text boxes, and display them in increasing numerical size.

    7.3 Cinema (movie theatre) price Write a program to work out how much a person pays to go to the cinema. The program should input an age from a track bar or a text box and then decide on the following basis:

    under 5, free;

    aged 5 to 12, half price;

    aged 13 to 54, full price;

    aged 55, or over, free.

    7.4 Betting A group of people are betting on the outcome of three throws of the dice. A person bets $1 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 $20;

    all three throws are the same (but not sixes): win $10;

    any two of the three throws are the same: win $5.

    7.5 Digital combination safe Write a program to act as the digital combination lock for a safe. Create three buttons, representing the numbers 1, 2 and 3. The user clicks on the buttons, attempting to guess the correct numbers (say 331121). The program remains unhelpfully quiet until the correct buttons are pressed. Then it congratulates the user with a suitable message. A button is provided to allow users to restart.

    Enhance the program so that it has another button which allows the user to change the safe's combination.

    7.6 Rock, scissors, paper game In its original form, each of the two players simultaneously chooses one of rock, scissors or paper. Rock beats scissors, paper beats rock and scissors beats paper. If both players choose the same, it is a draw. Write a program to play the game. The player selects one of three buttons, marked rock, scissors or paper. The computer makes its choice randomly using the random number generator. The computer also decides and displays who has won.

    7.7 The calculator Write a program which simulates a simple desk calculator (Figure 7.12) that acts on integer numbers. It has one button for each of the 10 digits, 0 to 9. It has a button to add and a button to subtract. It has a clear button, to clear the display, and an equals (=) button to get the answer.

    Figure 7.12. The calculator.


    When the clear button is pressed the display is set to zero and the (hidden) total is set to zero.

    When a digit button is pressed, the digit is added to the right of those already in the display (if any).

    When the + button is pressed, the number in the display is added to the total (and similarly for the – button).

    When the = button is pressed, the value of the total is displayed.

    7.8 The elevator Write a program to simulate a very primitive elevator. The elevator is represented as a filled rectangle. There are two buttons – one to make it move up the screen and one to make it move down.

    7.9 Nim is a game played with matchsticks (unused or used, it does not matter). It doesn't matter how many matches there are. The matches are put into three piles. Again, it doesn't matter how many matches there are in each pile. Each player goes in turn. A player can remove any number of matches from any one pile, but only one pile. A player must remove at least one match. The winner is the person who causes the other player to take the last match.

    Write a program to play the game. Initially the computer deals three piles, with a random number (in the range 1 to 200) of matches in each pile. One player is the computer, which chooses a pile and an amount randomly. The other player is the human user, who specifies the pile number and quantity using text boxes, before clicking on a 'go' button.

    7.10 Turtle graphics Turtle graphics is a way of making programming easy for young children. Imagine a pen fixed to the belly of a turtle. As the turtle crawls around a floor, the pen draws on the floor. The turtle can be issued with commands as follows:

    pen up

    pen down

    turn left 90°

    turn right 90°

    go forward n pixels

    Initially the turtle is at coordinates 0, 0 and facing to the right.

    So, for example, we can draw a rectangle using the sequence:

    pen down

    go forward 20 pixels

    turn right 90°

    go forward 20 pixels

    turn right 90°

    go forward 20 pixels

    turn right 90°

    go forward 20 pixels

    Write a program that behaves as the turtle, with one button for each of the commands. The number of pixels, n, to be moved is input via a track bar or a text box

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: program code in vb

    We do not do school projects here for free. Write the code yourself and ask specific questions.

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: program code in vb

    any one help me to making those program ...............means help ma in coding..........?
    Read the requirements carefully. Think about what needs to be done and how you would like to do it. Open your IDE and start writing your code. If you get stumped and have a specific question come back and ask the question. Be sure to include the segment of code you have written that you have a problem with and be sure to use code tags.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: program code in vb

    Did somebody steal Chapter 7 out of your book? That would be about the only reason that you should post something like that.

    Did you ever consider the fact that *someone* might GOOGLE their own questions to see who posted it (and see if the answer given was the one turned in)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured