none
help i have till tomorrow at midnight to finish everything or i dont graduate

    Question

  • can i have the proper codes for these projects;

    1. another assingment i have to Create a game application called “Risk!” in which the player begins with a score of 1000. The player decides on the number of points to risk and then rolls the dice. The points on each die are displayed.

    If the total of the two dice is even, the player loses and the points he/she risked are subtracted from the total. If the total of the two dice is odd, the player wins and is awarded double the amount of points he/she has risked.

    2. this assignment i have to Create an application, called “Range Rover” that will calculate a sum of numbers within a range determined by the user.

    The application will:

    • Ask the user to enter two numbers, a starting number and an ending number.
    • Calculate the sum of all the numbers between the starting number and the ending number. The starting number and the ending number should also be included in the sum of all the numbers.

    For example, if the user enters 1 and 5, as shown below, the application will calculate 1 + 2 + 3 + 4 + 5.

    Thursday, June 07, 2012 11:20 PM

Answers

  • Since these are homework assignments, we won't write the code for you.

    However, I'll give you some hints to help you get going - 

    For 1: You can use System.Random to simulate "rolling dice".  You can use the Console class to read and write user input.

    For 2: You can do this fairly simply using a For loop: http://msdn.microsoft.com/en-us/library/5z06z1kb.aspx


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Thursday, June 07, 2012 11:22 PM
  • "RangeRower" example:

    Module Module1
    
        Dim firstNumber As Integer
        Dim secondNumber As Integer
        Dim result As Integer
    
        Sub Main()
    
            'Get first number
            Console.WriteLine("Enter first number:")
            Dim firstInput = Console.ReadLine()
            Do Until Integer.TryParse(firstInput, firstNumber)
                Console.WriteLine(firstInput + " is not valid value. Enter valid value:")
                firstInput = Console.ReadLine()
            Loop
    
    
            'Get secont number
            Console.WriteLine("Enter second number:")
            Dim secondInput = Console.ReadLine()
            Do Until Integer.TryParse(secondInput, secondNumber)
                Console.WriteLine(firstInput + " is not valid value. Enter valid value:")
                firstInput = Console.ReadLine()
            Loop
    
    
            'Sum numbers
            If (secondNumber > firstNumber) Then
                While (firstNumber <= secondNumber)
                    result += firstNumber
                    firstNumber += 1
                End While
            Else
                While (secondNumber <= firstNumber)
                    result += secondNumber
                    secondNumber += 1
                End While
            End If
    
            'Print result
            Console.WriteLine("Result: " + result.ToString)
    
    
            Console.ReadKey()
    
        End Sub
    
    End Module


    Edit:

    Since these are homework assignments I will not post example for "Risk" game. 

    For rolling dice you can use Random class.

    Example: 

    Module Module1
    
        'declare randomizer at class level
        Dim randomizer As System.Random = New System.Random()
    
        Sub Main()
    
            'use randomizer.Next method to get new random integer
            'randomizer.Next(minimum, maximum)
            'generate random number
            Dim randomNumber As Integer = randomizer.Next(1, 100)
    
        End Sub
    
    End Module
    




    Thursday, June 07, 2012 11:44 PM

All replies

  • Since these are homework assignments, we won't write the code for you.

    However, I'll give you some hints to help you get going - 

    For 1: You can use System.Random to simulate "rolling dice".  You can use the Console class to read and write user input.

    For 2: You can do this fairly simply using a For loop: http://msdn.microsoft.com/en-us/library/5z06z1kb.aspx


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Thursday, June 07, 2012 11:22 PM
  • "RangeRower" example:

    Module Module1
    
        Dim firstNumber As Integer
        Dim secondNumber As Integer
        Dim result As Integer
    
        Sub Main()
    
            'Get first number
            Console.WriteLine("Enter first number:")
            Dim firstInput = Console.ReadLine()
            Do Until Integer.TryParse(firstInput, firstNumber)
                Console.WriteLine(firstInput + " is not valid value. Enter valid value:")
                firstInput = Console.ReadLine()
            Loop
    
    
            'Get secont number
            Console.WriteLine("Enter second number:")
            Dim secondInput = Console.ReadLine()
            Do Until Integer.TryParse(secondInput, secondNumber)
                Console.WriteLine(firstInput + " is not valid value. Enter valid value:")
                firstInput = Console.ReadLine()
            Loop
    
    
            'Sum numbers
            If (secondNumber > firstNumber) Then
                While (firstNumber <= secondNumber)
                    result += firstNumber
                    firstNumber += 1
                End While
            Else
                While (secondNumber <= firstNumber)
                    result += secondNumber
                    secondNumber += 1
                End While
            End If
    
            'Print result
            Console.WriteLine("Result: " + result.ToString)
    
    
            Console.ReadKey()
    
        End Sub
    
    End Module


    Edit:

    Since these are homework assignments I will not post example for "Risk" game. 

    For rolling dice you can use Random class.

    Example: 

    Module Module1
    
        'declare randomizer at class level
        Dim randomizer As System.Random = New System.Random()
    
        Sub Main()
    
            'use randomizer.Next method to get new random integer
            'randomizer.Next(minimum, maximum)
            'generate random number
            Dim randomNumber As Integer = randomizer.Next(1, 100)
    
        End Sub
    
    End Module
    




    Thursday, June 07, 2012 11:44 PM
  •      How's your homework coming along taddytravisd? You should get an A for plagiarism. Let us know if you graduate.

    You've taught me everything I know but not everything you know.

    Friday, June 08, 2012 2:48 PM