SHARE
TWEET

Untitled

a guest Jun 19th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Strict On
  2. Public Class Form1
  3.     'Program: Lab4jtgrkb
  4.    'Author:  James Griffin, jtgtrkb, lab K
  5.    'Date 9/29/10
  6.    'description: program to read a choosen file of member information, determine
  7.    'membership level and cost for year, process current payment toward
  8.    'that yearly membership
  9.  
  10.     Private Sub btnprocess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprocess.Click
  11.         '0. Declare variables
  12.        Dim sr As IO.StreamReader
  13.         Dim filename, fullname As String
  14.         Dim yearlyincome, previouspayment, memcost, fee As Double
  15.         Dim newBalanceDue, previousBalance, currentpay As Double
  16.         Dim day, memtype, first As String
  17.         Dim positionpoint As Integer
  18.         Dim clerkname As String
  19.         Dim formatstring As String = "{0,-20}  {1,20:C2}"
  20.         '0 Clear listbox
  21.        lstoutput.Items.Clear()
  22.         '1. Obtain name, income, and previous payment from the approariate file.
  23.        '   1a. determine the filename based on the combox box selected
  24.  
  25.         Select Case cbofile.Text
  26.             Case "Martin Wilson"
  27.                 filename = "Martin.txt"
  28.             Case "Delmelza Connor"
  29.                 filename = "Delmelza.txt"
  30.             Case "Alissa McKinnley"
  31.                 filename = "Alissa.txt"
  32.             Case Else
  33.                 cbofile.Text = "Haines Corporation"
  34.                 filename = "Haines.txt"
  35.  
  36.         End Select
  37.  
  38.         '   1b. open the file and read the first thre lines
  39.        '       (full member name, member income, previous payment,date).
  40.        sr = IO.File.OpenText(filename)
  41.         fullname = sr.ReadLine
  42.         yearlyincome = CDbl(Val(sr.ReadLine))
  43.         previouspayment = CDbl(Val(sr.ReadLine))
  44.         positionpoint = fullname.IndexOf(".")
  45.         first = fullname.Substring(positionpoint + 1).Trim
  46.         clerkname = txtclerk.Text
  47.         day = mskdate.Text
  48.         '   1c. Close the file
  49.        sr.Close()
  50.         '2. Determine the membership type based on the radio button selected.(elseif)
  51.        If radsingle.Checked Then
  52.             fee = 50
  53.             memtype = "Single"
  54.  
  55.         ElseIf radpartners.Checked Then
  56.             fee = 75
  57.             memtype = "Partners"
  58.         ElseIf radfamily.Checked Then
  59.             fee = 100
  60.             memtype = "Family"
  61.         ElseIf radcorporate.Checked Then
  62.             fee = 500 + 8750
  63.             memtype = "Corporate"
  64.      
  65.  
  66.         End If
  67.  
  68.  
  69.         '3. Get the current payment from the user via an input box.
  70.        currentpay = CDbl(InputBox("Enter Current Payment", "Payment", "100"))
  71.  
  72.         '4. Calculate the member cost based on the income.(use chart)
  73.        '   4a. Member cost for non-corporate members is based on chart in the lab 4 assignment
  74.  
  75.         Select Case yearlyincome
  76.             Case Is > 246750
  77.                 memcost = 3660 + 0.03 * (yearlyincome - 246750)
  78.             Case Is > 100350
  79.                 memcost = 1226 + 0.025 * (yearlyincome - 100350)
  80.             Case Is > 39050
  81.                 memcost = 328.5 + 0.02 * (yearlyincome - 39050)
  82.             Case Is > 17150
  83.                 memcost = 171.5 + 0.015 * (yearlyincome - 17150)
  84.             Case Else
  85.                 memcost = yearlyincome * 0.01
  86.         End Select
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.         '   4b. Member cost for corporate member is 8750.
  96.  
  97.  
  98.         '5  add category fee to membership cost
  99.        memcost = memcost + fee
  100.  
  101.  
  102.  
  103.  
  104.         '6. Do calculations (amount due, previous balance, yearly fees).
  105.  
  106.         previousBalance = memcost - previouspayment
  107.         newBalanceDue = previousBalance - currentpay
  108.         '7. Show all this stuff.(print)
  109.        lstoutput.Items.Add(String.Format(formatstring, "Clerk Name", clerkname))
  110.         lstoutput.Items.Add(String.Format(formatstring, "Date", day))
  111.         lstoutput.Items.Add(String.Format(formatstring, "___________", "______________"))
  112.         lstoutput.Items.Add(String.Format(formatstring, "Member:", first))
  113.         lstoutput.Items.Add(String.Format(formatstring, "Membership Type", memtype))
  114.         lstoutput.Items.Add(String.Format(formatstring, "Yearly Fees", memcost))
  115.         lstoutput.Items.Add(String.Format(formatstring, "Previous Payment", previouspayment))
  116.         lstoutput.Items.Add(String.Format(formatstring, " ", " ------------ "))
  117.         lstoutput.Items.Add(String.Format(formatstring, "Previous Balance", previousBalance))
  118.         lstoutput.Items.Add(String.Format(formatstring, "Current Payment", currentpay))
  119.         lstoutput.Items.Add(String.Format(formatstring, " ", " ------------ "))
  120.         lstoutput.Items.Add(String.Format(formatstring, "New Balance Due", newBalanceDue))
  121.  
  122.  
  123.     End Sub
  124.  
  125.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  126.         radcorporate.Checked = True
  127.         cbofile.Text = "Haines Corporation"
  128.     End Sub
  129.  
  130.     Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
  131.         End
  132.     End Sub
  133. End Class
RAW Paste Data
Top