Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN: 9781337102124
Author: Diane Zak
Publisher: Cengage Learning
Expert Solution & Answer
Book Icon
Chapter 4, Problem 2E

Explanation of Solution

Program

Public Class frmMain

'Declaring variables of type double and initializing with values

'variable twin

Dim twin As Double = 39.99

'variable full

Dim full As Double = 49.99

'variable queen

Dim queen As Double = 49.99

'variable king

Dim king As Double = 69.99

'variable totalCost

Dim totalCost As Double = 0

'variable shippingFee

Dim shippingFee As Double

'calculating total cost after clicking on button

Private Sub btnCost_Click(sender As Object, e As EventArgs) Handles btnCost.Click

'displaying total cost in textbox and Math.Round() is used to round the totalcost to two decimal places

txtCost.Text = String.Format("$" + Math.Round((totalCost + shippingFee), 2).ToString())

End Sub

'exit button click

Private Sub btnExit_Click (sender As Object, e As EventArgs) Handles btnExit.Click

Application.Exit()

End Sub

'checkbox CheckedChanged() event

Private Sub chkpickup_CheckedChanged(sender As Object, e As EventArgs) Handles chkpickup.CheckedChanged

'if checkbox is checked then

If (chkpickup.Checked = True) Then

'assign the shipping fee to the variable shippingFee

shippingFee = 5

Else

'else shippingFee is zero

shippingFee = 0

End If

End Sub

'radio button twin CheckedChanged() event

Private Sub rbtTwin_CheckedChanged(sender As Object, e As EventArgs) Handles rbtTwin.CheckedChanged

'if radio button is changed the clear values from textbox

txtCost.Text = ""

If (rbtTwin...

Blurred answer
Students have asked these similar questions
USe Form CS Create an application consists of 1 form with 30 controls: 1 Textbox 3 Radio buttons 2 Buttons 5 Checkboxes Code must be written to respond to the user clicking on the buttons, radio buttons and check boxes. Project requirements: 1. when the application starts the focus must be at the flavor selection list with the first flavor selected, one scoop selected and no toppings selected and the correct total displayed 2. when the "Exit" button is clicked, the application ends 3. the total will be computed and displayed when the user makes a scoop selection and/or toppings selection. 4. when the "Clear" button is clicked, the textbox is cleared. Focus goes to the listbox.. The first flavor is selected, one scoop is selected and no toppings are selected and the correct total is displayed 5. the total dollar amount must be formatted as currency 6. allow multiple flavors to be selected 7. the otal will times be an eflect the ber of scoops and toppings as they are selected
True or False Forms and most controls have a Preferences property that allows you to change the object’s background color.
Create the following form using C# Create a form ,name this new form: Loops Name all your objects clearly as in :i. txtLaptopCurrentPriceii. txtDesiredPriceiii. lstAnswerb. and likewise the corresponding variables that have the data type of the variableand matching the text box name as in:i. dblLaptopCurrentPrice = 0;ii. dblDesired Price = 0:iii. intCounter = 0;iv. dblTotal = 0;v. const dblYearlyDeduction = .10 7.The price of laptops is expected to go down by 10% per year. Use a while loop to display the year and price when the price will be under a specified target amount. Allow the user to specify the current price and the target price using TextBoxes .using a loop the number of years it will take for the Laptop to be less than or equal to your desired price.a. You should clear the list box as the first line of code (before while) in thecalculation area as in : lstAnswer.Items.Clear()b. Also set before the while statement dblTotal to be the current pricec. The formula (to help you…

Chapter 4 Solutions

Programming with Microsoft Visual Basic 2017

Ch. 4 - Prob. 3MQ3Ch. 4 - Prob. 4MQ3Ch. 4 - Prob. 1MQ4Ch. 4 - Prob. 2MQ4Ch. 4 - Prob. 3MQ4Ch. 4 - Prob. 1MQ5Ch. 4 - Prob. 2MQ5Ch. 4 - Prob. 3MQ5Ch. 4 - Prob. 1MQ6Ch. 4 - Jake’s Car Rental charges each customer a daily...Ch. 4 - Prob. 1MQ7Ch. 4 - Prob. 2MQ7Ch. 4 - Write a Case clause that specifies all numbers...Ch. 4 - Prob. 1MQ8Ch. 4 - Prob. 2MQ8Ch. 4 - Prob. 3MQ8Ch. 4 - A form contains six radio buttons. Three of the...Ch. 4 - Which property of the KeyPress procedures e...Ch. 4 - Which property of the KeyPress procedure’s e...Ch. 4 - Prob. 3MQ9Ch. 4 - Prob. 4MQ9Ch. 4 - Prob. 5MQ9Ch. 4 - Prob. 1RQCh. 4 - Prob. 2RQCh. 4 - Prob. 3RQCh. 4 - Prob. 4RQCh. 4 - Prob. 5RQCh. 4 - Prob. 6RQCh. 4 - Prob. 7RQCh. 4 - Prob. 8RQCh. 4 - Prob. 9RQCh. 4 - Prob. 10RQCh. 4 - Prob. 11RQCh. 4 - Prob. 12RQCh. 4 - Use the code shown in Figure 4-54 to answer Review...Ch. 4 - Use the code shown in Figure 4-54 to answer Review...Ch. 4 - Use the code shown in Figure 4-54 to answer Review...Ch. 4 - Prob. 16RQCh. 4 - Prob. 17RQCh. 4 - Prob. 18RQCh. 4 - Prob. 19RQCh. 4 - Prob. 20RQCh. 4 - Prob. 21RQCh. 4 - Prob. 22RQCh. 4 - Prob. 23RQCh. 4 - Prob. 24RQCh. 4 - Prob. 25RQCh. 4 - It is customary in Windows applications to...Ch. 4 - Prob. 27RQCh. 4 - Prob. 28RQCh. 4 - Prob. 29RQCh. 4 - Prob. 30RQCh. 4 - Prob. 31RQCh. 4 - Prob. 32RQCh. 4 - Prob. 33RQCh. 4 - Prob. 34RQCh. 4 - Which of the following statements is equivalent to...Ch. 4 - The six logical operators are listed below....Ch. 4 - An expression can contain arithmetic, comparison,...Ch. 4 - Prob. 1ECh. 4 - Prob. 2ECh. 4 - Prob. 3ECh. 4 - Prob. 7ECh. 4 - Prob. 11ECh. 4 - The purpose of this exercise is to demonstrate the...