0

Im having trouble with this code that I am suppose to write for my class. The program itself works until the looping. I have never made a loop before and i wasnt in class the day she introduced it so im kind of guessing on how its done. If anyone could post comments on how i should fix it that would be great. This is also in VBA

Module Bits

    Dim employeeName As String
    Dim currentSalary As Decimal
    Dim payIncrease As Single
    Dim runReply As Char
    Dim employeeSalary As Single
    Dim numbersOfEmployees As Decimal
    Dim projectedSalary As Decimal
    Dim increasedSalary As Decimal
    Dim y As Char
    Dim n As Char

    Sub Main()

            Console.Out.WriteLine("Bits and Pieces Manufacturing Company")
            Console.Out.WriteLine(DateString & "                        By.Cristian Bouchez")

        Do

            Console.Out.Write(vbCrLf & "Enter your employee's name:                    ")
            employeeName = Console.In.ReadLine()
            Console.Out.Write("Enter your employee's current weekly salary:  $")
            currentSalary = Console.In.ReadLine()
            Console.Out.Write("Enter your employee's pay increase:           %")
            payIncrease = Console.In.ReadLine()

            payIncrease = payIncrease / 100
            employeeSalary = currentSalary * payIncrease
            payIncrease = payIncrease * 100
            employeeSalary = employeeSalary + currentSalary

            numbersOfEmployees = numbersOfEmployees + 1
            projectedSalary = projectedSalary + currentSalary
            increasedSalary = increasedSalary + (employeeSalary - currentSalary)

            Console.Out.WriteLine(vbCrLf & vbCrLf & employeeName & " will earn $" & employeeSalary & _
                                  " after a %" & payIncrease & " raise.")

            Console.Out.WriteLine(vbCrLf & "Do you want to calaculate another employee's weekly pay?")
            Console.Out.Write("Enter Y for yes and N for no:  ")
            runReply = Console.In.ReadLine()

            Console.ReadKey()

        Loop Until runReply = n

        Console.Out.WriteLine(vbCrLf & "*******************************" & vbCrLf)

    End Sub

End Module
4

1 回答 1

2

1) 设置 n= "n"
2) 循环直到 LCase(runReply) = n

于 2012-09-29T18:41:56.957 回答