944,147 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 6177
  • VB.NET RSS
Oct 25th, 2005
0

VB cash register needed

Expand Post »
I need help in my VB class making a cash register. I know I'm supposed to use modulus and integer functions as well as nested if's, but am having a hard time coding it. If you haven't figured it out yet, this is my first real attempt at coding in VB.

Here's the assignment:

You must create an application that determines the most efficent change to be given from a one dollar bill. The change should be given in terms of quarters, pennies, nickels, and dimes.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
CHUDMASTER is offline Offline
2 posts
since Oct 2005
Oct 25th, 2005
0

Re: VB cash register needed

Quote originally posted by CHUDMASTER ...
I need help in my VB class making a cash register. I know I'm supposed to use modulus and integer functions as well as nested if's, but am having a hard time coding it. If you haven't figured it out yet, this is my first real attempt at coding in VB.

Here's the assignment:

You must create an application that determines the most efficent change to be given from a one dollar bill. The change should be given in terms of quarters, pennies, nickels, and dimes.
Very interesting, VB 6 or .Net??
Reputation Points: 8
Solved Threads: 6
Posting Whiz in Training
extofer is offline Offline
239 posts
since Aug 2005
Oct 25th, 2005
0

Re: VB cash register needed

I'm looking for VB.Net....here's what I have so far but I seriously doubt it's even close to being right.........

Private Sub btnChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChange.Click
Dim Cash As Integer
Const Pennies As Integer = 0.01
Const Quarters As Integer = 0.25
Const Nickels As Integer = 0.05
Const Dimes As Integer = 0.1
Const Dollar As Integer = 1.0

Cash = Val(txtChange.Text)

If Cash Mod Quarters = 0 Then
Me.lblQuarters.Text = Dollar / Quarters
ElseIf Cash Mod Dimes = 0 Then
Me.lblDimes.Text = Dollar / Dimes
ElseIf Cash Mod Nickels = 0 Then
Me.lblNickels.Text = Dollar / Nickels
ElseIf Cash Mod Pennies = 0 Then
Me.lblPennies.Text = Dollar / Pennies

End If

End Sub

Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
Me.Close()
End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click

End Sub
End Class
Reputation Points: 10
Solved Threads: 0
Newbie Poster
CHUDMASTER is offline Offline
2 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Using Windows XP Visual Styles with Controls on Windows Forms
Next Thread in VB.NET Forum Timeline: Calculate Averages for a Class program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC