Jimboo 0 Newbie Poster

Hi,

I have a problem creating correct extra methods for a piece of fixed code. I should write 3 methods I assume for this code.

Fixed code:

Module NumberArrays
    Sub Main()
        Dim count As Integer = 0
        Dim values(1) As Integer
        Do
            PrintValues(values, count)
            '
            Console.Write("Value ? : ")
            Dim newValue As Integer = Console.ReadLine()
            count += 1
            '
            If count > values.Length Then
                values = GetArrayWithDoubledCapacity(values)
            End If
            '
            StoreValue(values, newValue, count - 1)
        Loop
        '
        Console.ReadLine()
    End Sub

I should get the exact same output as below. Value ? is input of the user:

Values (count=0/capacity=2) :
Value ? : 10
Values (count=1/capacity=2) : 10
Value ? : 20
Values (count=2/capacity=2) : 10 20
Value ? : 30
Values (count=3/capacity=4) : 10 20 30
Value ? : 40
Values (count=4/capacity=4) : 10 20 30 40
Value ? : 50
Values (count=5/capacity=8) : 10 20 30 40 50
Value ? : 60
Values (count=6/capacity=8) : 10 20 30 40 50 60
Value ? : 70
Values (count=7/capacity=8) : 10 20 30 40 50 60 70
Value ? : 80
Values (count=8/capacity=8) : 10 20 30 40 50 60 70 80
Value ? : 90
Values (count=9/capacity=16) : 10 20 30 40 50 60 70 80 90
Value ? :

My methods till now:

Function PrintValues(ByVal values As Integer(), ByVal count As Integer)
        Console.WriteLine("Values (count=" & count + 1 & "/capacity=")
        Return values
    End Function
    Function GetArrayWithDoubledCapacity(ByVal values As Integer() )
        Console.Write(values)

        Return values
    End Function

    Function StoreValue(ByVal values As Integer(), ByVal newValue As Integer, ByVal Count As Integer)

        Return values
    End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.