
-----------------------------------
mmyles1949
Sat Oct 15, 2011 4:59 pm

New to programming need help in visual Basic 10 assignments
-----------------------------------
This is my assignment 
and I have posted what I have at the bottom of the assignment.
I am having problems because my instructor just started teaching he actually works for the school and it`s an intro class but he teaches it like we already know it.

Coin Flips 1

Write a program that simulates flipping a coin some number of times. Count how many times the result is "heads" and how many times the result is "tails".

Have the user enter a value to tell your program how many times to flip the coin. If the value they enter is not a positive numeral, have the program ask the user again how many times they would like to flip the coin. Use a "Do While" loop to accomplish this.

Your program should then flip the coin the specified number of times. After each "flip", write an "H" or a "T" to the console window to represent the result of that coin flip. Use a "For" loop to to process the flips.

To actually determine whether your coin flip was a head or a tail, use the Random.Next() function to generate either a 0 or a 1. You can decide which numeric result corresponds to a "heads" result and which is a "tails". Just be consistent.

Once your "For" loop has finished, display a final line that tells the user how many times the coin came up heads and how many times it came up tails.

Here is a sample of what your program should look like. I highlighted the input values to make them stand out (this is not a requirement of the assignment, however). Notice that my program continues to prompt for a valid input value until I give it a positive number:

Melvin T Myles Lab-7 Coin_Flips1
Option Strict On
Module Coin_Flips1

    Sub Main()
        Dim tempInput As String
        Dim Heads As Integer
        Dim Tails As Integer
        Dim RNG As Random
        Dim flips As Integer
        Dim strTemp As String
        RNG = New Random


        Heads =
        Tails=
        flips= RNG.Next(0, 1))

        Do

            Console.Write("This program will flip a coin a specified number of times. ")
            Console.WriteLine("How many times would you like to flip the coin?")
            tempInput = (Console.ReadLine())
                If (IsNumeric(tempInput)) Then
                    flips = CInt(tempInput)
                Else
                    Console.WriteLine("Invalid input. Please input a valid number")


            End If
        Loop

        'Loop-Flip Coin

        Console.ReadKey()
    End Sub

End Module


Can some one please help never done programming before and I really need to pass this class

-----------------------------------
Tony
Sat Oct 15, 2011 5:30 pm

Re: New to programming need help in visual Basic 10 assignments
-----------------------------------
it`s an intro class but he teaches it like we already know it.

Doesn't seem that way.


... Use a "Do While" loop to accomplish this....

... Use a "For" loop to to process the flips....

... use the Random.Next() function to generate either a 0 or a 1....

...Once your "For" loop has finished...

... Here is a sample of what your program should look like.
Your teacher is going much further than most in outlining the steps that you need to take, and even provides code for the bulk of the work already done.

Just follow his steps, one at a time. If you don't understand a particular step (e.g. "how do I use a do-while loop?"), use class or online resources to read up on that.

-----------------------------------
mmyles1949
Sat Oct 15, 2011 5:48 pm

Re: New to programming need help in visual Basic 10 assignments
-----------------------------------
the code you see is what I compiled he doesn't provide code

-----------------------------------
Tony
Sat Oct 15, 2011 5:51 pm

RE:New to programming need help in visual Basic 10 assignments
-----------------------------------
So a compiled binary? Sure, that's still a bunch of information though. And he still outlines the steps that will get you there.

What is a specific problem(s) that you are having with this assignment?

-----------------------------------
mmyles1949
Sat Oct 15, 2011 6:03 pm

RE:New to programming need help in visual Basic 10 assignments
-----------------------------------
its like this I told my instructor you can`t talk thug to a geek and expect them to understand I am not a geek so I really cant catch on to his explanations.
dont get me wrong he is very good and thats why he doesnt know how to slow down for the students that never have done programming.

but in a nutshell I dont know where to start my for to read out the calculations.

-----------------------------------
mmyles1949
Sat Oct 15, 2011 6:08 pm

RE:New to programming need help in visual Basic 10 assignments
-----------------------------------
I had him before in php and the Dean of CIS told him he teaches the class to fast now he is doing VB 10 he still teaches it the same way.

-----------------------------------
mmyles1949
Sat Oct 15, 2011 6:10 pm

RE:New to programming need help in visual Basic 10 assignments
-----------------------------------
I gave up last time but I am really trying hard to get this i am a disabled vet going to school through a veterans vocational rehabilitation program and cant afford to fail.

-----------------------------------
Tony
Sat Oct 15, 2011 6:17 pm

Re: RE:New to programming need help in visual Basic 10 assignments
-----------------------------------
I had him before in php
never done programming before
wut?

in a nutshell I dont know where to start my for
As soon as you know how long your loop should be (so right after getting valid input from the user).

-----------------------------------
mmyles1949
Sat Oct 15, 2011 6:18 pm

RE:New to programming need help in visual Basic 10 assignments
-----------------------------------
Thank You I will try to put it together

-----------------------------------
mmyles1949
Wed Oct 19, 2011 10:07 pm

Re: New to programming need help in visual Basic 10 assignments
-----------------------------------
Hey Tony I figured the other assignment out took sometime but I got it but I posted another could look it over for me

-----------------------------------
mmyles1949
Wed Oct 19, 2011 10:14 pm

Re: New to programming need help in visual Basic 10 assignments
-----------------------------------
Scratch that I need to know how to increment in 5`s across the top of the table up to 30 here`s what i got


'Melvin T Myles Loan3
Option Strict On
Module Loan3

    Sub Main()
        Dim CursorPosition As Integer
       



        Console.WriteLine("      Loan Payment table for a Loan of $100000  ")
        Console.WriteLine()
        Console.Write("      ")
        For table1 As Integer = 5 to 30 

            CursorPosition = Console.CursorLeft
            Console.Write(CDbl(Format(table1, "0#")))
            CursorPosition = Console.CursorLeft
            Console.CursorLeft = CursorPosition + 2
        Next
        Console.WriteLine()
        Console.WriteLine("    ------------------------------------")

        For table2 As Integer = 1 To 9

        Next
        Console.WriteLine()
        Console.ReadKey()

-----------------------------------
Tony
Wed Oct 19, 2011 10:22 pm

RE:New to programming need help in visual Basic 10 assignments
-----------------------------------
if you can increment loops by 1, then you can simply count up to 5s before doing any useful work.

You can then look up the documentation on for-loops to see if they allow you to specify by how much to increment the counter.
