Question

In: Computer Science

Goal: After the manager of a local McDonalds hired several ASU grads to work the cash...

Goal:

After the manager of a local McDonalds hired several ASU grads to work the cash registers, he realized that they were having trouble figuring out the correct amount of change to return to their customers. The manager wants you to create a VB.NET program that calculates the correct amount of change to be given to a customer following a transaction.

Guidelines:

You should have

  • Option Explicit On (this forces you to declare all of your variables)
  • Option Strict On (this forces you to explicitly convert from one data type to another rather than relying on VB.Net to make these conversions for you implicitly)
  • At least one relevant image on your form (lots of McDonalds and $$ images available on the Net)
  • Calculate, Clear, and Exit buttons along the bottom of your form

Inputs:

  Transaction Amount

  validation: data must have been entered, data must be numeric, amount cannot be negative or greater than $1000.00

Amount of Cash Provided By The Customer

validation: data must have been entered, data must be numeric,

amount cannot be negative and must be equal to or greater than the Transaction Amount

Outputs:

Total Amount of Change To Be Returned

Number of Twenties To Be Returned

Number of Tens To Be Returned

Number of Fives To Be Returned

Number of Ones To Be Returned

Number of Quarters To Be Returned

Number of Dimes To Be Returned

Number of Nickels To Be Returned

Number of Pennies To Be Returned

Solutions

Expert Solution

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

NOTE :HERE IMAGE IS SHOWN FOR DEMONSTRATION PURPOSE ONLY.

Here a new Windows Forms Application in VB is created using Visual Studio 2017 with name "VBChangeAmount".This application contains a form with name "Form1.vb".Below are the files associated with form1.

1.Form1.vb[Design]

2.Form1.vb

Option Explicit On
Option Strict On
Public Class Form1
'Calculate button click
Private Sub btnChange_Click(sender As Object, e As EventArgs) Handles btnChange.Click
'declaring variables
Dim twenties As Integer
Dim tens As Integer
Dim fives As Integer
Dim ones As Integer
Dim quarters As Integer
Dim dimes As Integer
Dim nickels As Integer
Dim pennis As Integer
Dim cents As Integer
Dim amount As Integer 'variable to store amount
' If Integer.TryParse(txtTransaction.Text, amount) Then
'when valid transaction amount is entered
amount = Integer.Parse(txtTransaction.Text)
If amount > 0 And amount <= 1000 Then
'if amount between 0 to 1000 entered then
cents = amount 'storing amount
'checking amount
If amount >= 20 Then
twenties = CInt(Fix(amount / 20)) 'finding twenties
amount = amount Mod 20 'finding remaining amount
End If
'checking amount
If amount >= 10 Then
tens = CInt(Fix(amount / 10)) 'finding tens
amount = amount Mod 10 'finding remaining amount
End If
'checking amount
If amount >= 5 Then
fives = CInt(Fix(amount / 5)) 'finding fives
amount = amount Mod 5 'finding remaining amount
End If
'checking amount
If amount >= 1 Then
ones = CInt(Fix(amount)) 'finding ones
End If
'finding quarters, dimes , nickels and pennis
'checking cents
If cents >= 25 Then
quarters = CInt(Fix(cents / 25)) 'finding quarters
cents = cents Mod 25 'finding remaining amount
End If
'checking cents
If cents >= 10 Then
dimes = CInt(Fix(cents / 10)) 'finding dimes
cents = cents Mod 10 'finding remaining amount
End If
'checking cents
If cents >= 5 Then
nickels = CInt(Fix(cents / 5)) 'finding nickels
cents = cents Mod 5 'finding remaining amount
End If
'checking cents
If cents >= 1 Then
pennis = CInt(Convert.ToInt32(cents)) 'finding pennis
End If
'display details on the label
lblChangeAmount.Text = "Total Amount of Change : " & txtTransaction.Text & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Twenties : " & twenties & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Tens : " & tens & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Fives : " & fives & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Ones : " & ones & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Quarters : " & quarters & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Dimes : " & dimes & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Nickels : " & nickels & Environment.NewLine
lblChangeAmount.Text = lblChangeAmount.Text & "Number of Pennies : " & pennis & Environment.NewLine

Else
'if amount is not in the range
lblChangeAmount.Text = "Enter valid amount between 0 to 1000"
End If
' Else
'if non numeric amount is entered
'lblChangeAmount.Text = "Enter valid transaction amount in numbers"
' End If
End Sub
'clear button click
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
lblChangeAmount.Text = ""
txtTransaction.Text = ""
End Sub
'Exit button click
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close() 'when this button clicked close form
End Sub
End Class

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :

Screen 2 :Screen when invalid transaction amount is entered

Screen 3 :Screen showing details

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.


Related Solutions

As the manager of a local hotel chain, you have hired an econometrician to estimate the...
As the manager of a local hotel chain, you have hired an econometrician to estimate the demand for one of your hotels (H). The estimation has resulted in the following demand function: QH = 3,000 – PH – 1.8PC – 2.5PSE + 2.4POH + .01M, where, PH is the price of a room at your hotel, PC is the price of concerts in your area, PSE is the price of sporting events in your area, POH is the average room...
You have been hired to promote the work of a local organization that provides services to...
You have been hired to promote the work of a local organization that provides services to troubled teenagers. Before beginning your job, you have been told that the organization cannot engage in advertising due to the sources of its funding. What other promotional options can you use in spite of the lack of budget?
You are manager of a district that has just hired several recent university and college graduates....
You are manager of a district that has just hired several recent university and college graduates. Most of these people are starting their first full-time job, although most or all have held part-time and summer positions in the past. They have general knowledge of their particular skill area (accounting, engineering, marketing, etc.) but know relatively little about specific business practices and developments. Explain how you would nurture the self-concepts in these new hires to strengthen their performance and maintain their...
You are hired as a financial manager and your first task is to establish the cash...
You are hired as a financial manager and your first task is to establish the cash budget of your firm. You gathered the following information. The firm receives all income from sales Sales estimates (in millions) Q1 = 1,000; Q2 = 1,250; Q3 = 1,500; Q4 = 2,000; Q1 next year = 1,200 Accounts receivable Beginning receivables = $3000 Average collection period = 45 days Accounts payable Purchases = 60% of next quarter’s sales Beginning payables = 1,200 Accounts payable...
You worked in a small local company as an assistant manager for several years. Now you...
You worked in a small local company as an assistant manager for several years. Now you quit the job and start your own business. You persuade your cousin to become a co-owner and invest $76,000 in the startup business. You invest $24,000 equity capital in the business. The business is organized as a limited liability company (LLC). You are the managing member, whereas your cousin is only a passive investor who does not manage the day-to-day operations. You also persuade...
= The local hospital offers an incentive for nurses to work longer shifts. After a regular...
= The local hospital offers an incentive for nurses to work longer shifts. After a regular 8-hour shift, they can make double time on the remainder of their shift. That is, they make twice their salary for each hour they work over 8 hours. Nurse Jane works 12 hour shifts Monday through Friday. Her weekly gross income is $2136.00 , what is her base salary? Daniel is a very good television salesperson. His annual sales average at $187,400. His commission...
You are working at a local hospital working a medical social work case manager with your...
You are working at a local hospital working a medical social work case manager with your newest client on discharge planning. Your hospital allows you to work with clients to provide case management services and support for up to 60 days following their discharge from the hospital. You have been assigned to work with your latest client, Larry. Larry is a 35 year old single father of 3 children, ages 5, 6, 14. He was admitted to the hospital 19...
*After leaving work one night, Bill decided to stop at local bar to have a few...
*After leaving work one night, Bill decided to stop at local bar to have a few drinks before he got home. Bill had one drink too many and become intoxicated. Nevertheless, Bill though he was able to drive home. On his way home, Bill swerved to avoid hitting a little boy in the street and hit Melissa with his car. Melissa broke her leg and wants to sue Bill. Can Bill be held liable under tort law and criminal law?...
after completing its capital spending for the year, carlson manufacturing has $1,800 extra cash. carlson's manager...
after completing its capital spending for the year, carlson manufacturing has $1,800 extra cash. carlson's manager must choose between investing the cash in treasury bonds that yield 3 percent or paying the cash out to investors who would invest in the bonds themselves. a. if the corporate tax rate is 23 percent, what personal tax rate would make the investors equally to receive the dividend or to let carlson invest the money? b. id the answer to (a) reasonable? c....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT