Visual Basic/Visual Basic

Advertisement


Tiago wrote at 2014-11-24 23:43:31
This is what i did, its much simpler than the ones above and it works perfectly:



'Programmed by: Tiago Sa

'Programmed for: Mr. L. Calomeni

'Course: VICS3U1

'Date: Tuesday, November 25, 2014.

'Program description: To display the amount of change the user inputs

'          in Quarters, Dimes, Nickels and pennies.



Public Class Change



   Private Sub Coins_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Coins.Click

       'INPUT

       'Declare variables

       Dim Pennies, Dimes, Quarters, Nickels, Money As Decimal

       

       'Processing

       Money = Val(Me.txtCents.Text)

       Quarters = Money \ 25

       Dimes = (Money - Quarters * 25) \ 10

       Nickels = (Money - Quarters * 25 - Dimes * 10) \ 5

       Pennies = (Money - Quarters * 25 - Dimes * 10 - Nickels * 5) \ 1



       'OUTPUT

       'Display answer

       lblQuarters.Text = "The amount of quarters is: " & Quarters

       lblDimes.Text = "The amount of dimes is: " & Dimes

       lblNickels.Text = "The amount of nickels is: " & Nickels

       lblPennies.Text = "The amount of pennies is: " & Pennies



   End Sub

End Class


Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


VITALY

Expertise

Area of expertise is Visual Basic .NET (VS 2008 and Framework 3.5) design and development for Windows applications. You can ask me any Visual Basic questions and some questions about .NET Framework. You can also ask me how to use Component One controls in Visual Basic. Do not ask me questions about Web design and development in Visual Basic.

Experience

I'm working as VB programmer from 1997, so I have a lot of experience with Visual Basic .NET as well as Visual Basic 6. Area of expertise is Visual Basic .NET (VS 2008 and Framework 3.5) design and development for Windows applications; Component One controls for Visual Basic; User controls; Moving VB6 applications to .NET.

Education/Credentials
B.S. in Computer Science

©2016 About.com. All rights reserved.