Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Visual Basic Problem: Three employees in a company are up for a special pay incr

ID: 3690483 • Letter: V

Question

Visual Basic Problem:

Three employees in a company are up for a special pay increase. You are given a file, say InputData.txt, with the following data:

Miller Andrew

65789.87

Green Sheila

75892.56

Sethi Amit

74900.50

First line contains an employee’s name, next line his current salary, and the next line is percent pay increase. For example, in the first input line, the name of the employee is Miller Andrew, the next line contains his current salary is 65789.87, and the line after contains his pay increase is 5%. The same pattern repeats 3 times.

Write a method ReadingWriting which accepts a file of the following format as input. The method ReadingWriting does the following:

reads data from the InputData.txt file

Write output in the output file out.txt.

For each employee, the data must be outputted in the following way:

, updatedSalary.

Calculate updatedSalary using the formula:

= current salary + (current salary * pay increase)

Format the updatedSalary of decimal numbers to two decimal places.

Note: Use loop to read and write from the file

Explanation / Answer

Imports System.IO

Module Module1

    Sub Main()

        Dim outData As System.IO.StreamWriter

        Dim lastName As String = ""
        Dim firstName As String = ""
        Dim currentsalary As Double = 0
        Dim raisePercentage As Double = 0
        Dim newSalary As Double = 0
        Dim objStreamReader As StreamReader
        objStreamReader = New StreamReader("C:UsersSamuelsDesktopinput.txt")

        firstName = objStreamReader.ReadLine
        lastName = objStreamReader.ReadLine
        currentsalary = objStreamReader.ReadLine
        raisePercentage = objStreamReader.ReadLine
        newSalary = currentsalary + (currentsalary * raisePercentage)
    End Sub

End Module