3 Replies - 832 Views - Last Post: 17 December 2008 - 06:30 PM Rate Topic: -----

#1 pasky66   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 26-October 08

Help with a service fee program

Post icon  Posted 01 November 2008 - 07:48 PM

I am trying to code a program that calculates fees for a cable company the assignment asks to compute fees for business and residential customers. the residential part works but the business side should add an additional fee of 4D for any additional connections over 10 can not seem to get that part to work.

Public Class Form1

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		For premiumChannel As Integer = 0 To 20
			premiumListBox.Items.Add(premiumChannel.ToString)
		Next premiumChannel

		For connection As Integer = 0 To 100
			connectionListBox.Items.Add(connection.ToString)
		Next connection

		premiumListBox.SelectedIndex = 0
		connectionListBox.SelectedIndex = 0
	End Sub


	Private Function CalcResidentialTotalDue(ByVal connections As Decimal, _
ByVal premium As Decimal, ByVal Pfee As Decimal, _
ByVal Sfee As Decimal) As Decimal


		Const residentialProcessing As Decimal = 4.5D
		Const residentialBasic As Decimal = 30D
		Const residentialPremium As Decimal = 5D
		Dim premiumChannels As Decimal
		Dim charge As Decimal

		connectionListBox.SelectedIndex = 0

		premiumChannels = Convert.ToDecimal(premiumListBox.SelectedItem)

		charge = residentialProcessing + residentialBasic + residentialPremium * premiumChannels

		Return charge


	End Function

	Private Function calcBusinessTotalDue(ByVal connections As Decimal, _
ByVal premium As Decimal, ByVal Pfee As Decimal, _
ByVal Sfee As Decimal) As Decimal

		Const businessProcessing As Decimal = 16.5D
		Dim businessBasic As Decimal = 80D
		Const businessPremium As Decimal = 50D
		Dim additionalConnection As Decimal = 4D
		Dim premiumChannels As Decimal
		Dim charge As Decimal
		Dim connection As Decimal
		Dim businessFirstTenConnections As Decimal
		connectionListBox.SelectedIndex = 1



		premiumChannels = Convert.ToDecimal(premiumListBox.SelectedItem)
		connection = Convert.ToDecimal(connectionListBox.SelectedItem)

		

	   
		charge = businessProcessing + businessBasic + businessPremium * premiumChannels

		Return charge


	End Function


	Private Sub calcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles calcButton.Click
		Dim charge As Decimal
		Dim premium As Decimal
		Dim serviceFee As Decimal
		Dim processingFee As Decimal
		Dim premiumChannels As Decimal
		Dim premiumFee As Decimal
		Dim premiumCharge As Decimal
		Dim totalDue As Decimal

		If residentialRadioButton2.Checked Then
			processingFee = 4.5D
			serviceFee = 30D
			premiumFee = 5D
			premiumChannels = Convert.ToDecimal(premiumListBox.SelectedItem)
			premiumCharge = premiumFee * premiumChannels
			totalDue = CalcResidentialTotalDue(charge, premium, processingFee, _
			serviceFee)

		End If
		totalLabel.Text = totalDue.ToString("C2")

		If businessRadioButton1.Checked Then
			processingFee = 16.5D
			serviceFee = 80D
			premiumFee = 50D
			premiumChannels = Convert.ToDecimal(premiumListBox.SelectedItem)
			premiumCharge = premiumFee * premiumChannels
			totalDue = calcBusinessTotalDue(charge, premium, processingFee, _
			serviceFee)


		End If
		totalLabel.Text = totalDue.ToString("C2")
	End Sub


	Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
		Me.Close()
	End Sub
End Class



Is This A Good Question/Topic? 0
  • +

Replies To: Help with a service fee program

#2 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Help with a service fee program

Posted 01 November 2008 - 09:08 PM

Moved to VB.NET :)
Was This Post Helpful? 0
  • +
  • -

#3 XiJiangWoo   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 06-April 08

Re: Help with a service fee program

Posted 17 December 2008 - 06:21 PM

I'm doing a similar project. When I get to that point I'll try to help.

Does anyone have any advice?
Was This Post Helpful? 0
  • +
  • -

#4 oasisjoel   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Re: Help with a service fee program

Posted 17 December 2008 - 06:30 PM

what the problem? I don't know the formulas for that could post it?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1