Assignment 1
Your program must:
1. Read each line
2. Split the line you've read
3. Using the same method as in P1 and P2, calculate the federal tax due for that fedagi
4. Output the person's name and their calculated fedtax amount on separate lines to another file (output.txt)

You will need to create Streamreader, FileSystem, and Writer objects. All reading of the file will be within a LOOP (one readline inside the loop). The tax calculation will also be inside this loop. As a final task inside the loop you will have to use writeline() commands to output to the other file (output.txt).
Do not forget to close the file with w.close() AFTER the loop has completed to retain all of your output.

Input file:

Assignment 2
Each line in the input file will represent someone's information that you will need to process - with each line having multiple values:
Name, gross, 401k
You will need to create all needed Streamreader, Filestream, and writer objects. (Be sure your input file is in your projects bin/debug folder or your program will not find it when needed).
Begin a file read loop
read a line from the file and store it into a string
Use the .Split(",") command to break that initial string into accessible pieces
If you use the example in Wordsplitter:
Dim words() as String = strinput.Split(",")
words(0) would contain the name, words(1) the gross, words(2) the 401k amount
Calculate the fedagi with a function and store the returned amount in a variable
fedagi = calcfedagi(words(1),words(2))
You need to make sure your functions are using proper inputs(No public variables, or control access from functions!)
Calculate the fedtax with a function and store the returned amount in another variable.
Output to a file the persons name and fedtax amount to separate lines with proper labeling of those values:
Name: Maddie
Federal Tax: 4300

End file read loop
Close your file with w.close

Example template of fedagi function
function calcfedagi(Byval gross as Double,Byval retire as Double) As Double
Return gross - retire - 10500
End Function
This function requires 2 parameters to be supplied when calling it. If you receive any errors with typecasting, use the CDbl() command for the strings you are sending into the paramters. Example
fedagi = calcfedagi(CDbl(words(1)), CDbl(words(2)))

Input file:

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

Imports System
Imports System.IO

Module Program
    Sub Main(args As String())

       ' ../../../ start from folder that contains executed file
       Dim inPath As String = "../../../input.txt"
       Dim outPath As String = "../../../output.txt"

            Dim sr As StreamReader = New StreamReader(inPath)
            Dim sw As StreamWriter = New StreamWriter(outPath)

            Do While sr.Peek() >= 0
                Dim words() = sr.ReadLine().Split(",")
                Dim agi As Double = CDbl(words(1))

                sw.WriteLine(words(0) & "," & getTaxRate(agi))

       Catch e As Exception
            Console.WriteLine("The process failed: {0}", e.ToString())
       End Try
    End Sub...

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Visual Basic Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats