In: Computer Science
In this exercise, you will complete the Restaurant Tip application from Chapter 2’s Focus on the Concepts lesson. The application’s Planning Chart is shown in Figure 3-34.
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Here a new Windows Forms Application in VB is created using Visual Studio 2017 with name "TipSolution".This application contains a form with name "Form1.vb".Below are the files associated with form1.
1.Form1.vb[Design]
2.Form1.vb
Option Strict On
Option Explicit On
Option Infer On
Public Class Form1
'Calculate button click procedure
Private Sub btnCalculate_Click(sender As Object, e As EventArgs)
Handles btnCalculate.Click
'declaring variables
Dim restaurentBill As Double
Dim tipPercentage As Double
Dim tip As Double
'taking restaurent Bill entered by user
restaurentBill = Double.Parse(txtRestaurantBill.Text)
'taking tip percentage entered by user
tipPercentage = Double.Parse(txtTipPercentage.Text)
'calculate and display tip
tip = restaurentBill * (tipPercentage / 100)
'display tip on label
lblTip.Text = "Tip : $" & tip.ToString("0.00")
End Sub
End Class
======================================================
Output : Run application using F5 and will get the screen as shown below
Screen 1 :
Screen 2:Enter restaurant bill amount and tip percentage to calculate tip
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.