Question

Visual Basic Write the code snippit for the btnCalculate event handler based upon the following pseudo-code...

Visual Basic

Write the code snippit for the btnCalculate event handler based upon the following pseudo-code and User Interface. Don’t forget to create all variables needed and perform all necessary data conversions (ToString,TryParse). Use the control names listed in the pseudo-code. The pseudo-code is as follows

Create variables for item cost (dblCost) and item amount (dblAmount)

Get the item cost from tbxCost and place it in the variable(dblCost)

Gt item amount from tbxAmount and place in it the variable (dblAmount)

If the item amount or item cost is zero

            Display the message “Enter amount and cost” in the label (lblResult)

Else

            Calculate the total cost by multiplying the item cost by the item amount

            Display the total cost in lblResult as currency with two decimal places

Endif

Homework Answers

Answer #1

Code:=

Dim dblCost, dblAmount As Integer
    Dim tcost As Double

    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

        dblCost = Val(tbxCost.Text)
        dblAmount = Val(tbxAmount.Text)
        If dblCost = 0 Or dblAmount = 0 Then
            lblResult.Text = "Enter the Cost and Amount"
        Else
            tcost = dblCost * dblAmount
            lblResult.Text = "Total cost is Rs. " & FormatNumber(tcost, 2)
        End If
    End Sub

    Output:=

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName (a String), numSold (an integer that represents the number of that type of game sold), and priceEach (a double that is the price of each of that type of Game). I only want three instance variables!! The class should have the following methods: A constructor that has two parameter – a String containing the name of the Game and a double containing its price....
Use a few sentences to describe the problem given below . Also, Identify the nouns and...
Use a few sentences to describe the problem given below . Also, Identify the nouns and verbs used in the below project descriptions.  Identified nouns, list the ones that are necessary to define variables in your program. For each variable, specify its name, data type, and what information it is used to store. Write the pseudo code algorithm (i.e. algorithm steps) to solve this problem. (For the base salaries and commission rates use constants instead to keep these values. Use the...
Coding in Python Add radio button options for filing status to the tax calculator program of...
Coding in Python Add radio button options for filing status to the tax calculator program of Project 1. The user selects one of these options to determine the tax rate. The Single option’s rate is 20%. The Married option is 15%. The Divorced option is 10%. The default option is Single. Be sure to use the field names provided in the comments in your starter code. ================== Project 1 code: # Initialize the constants TAX_RATE = 0.20 STANDARD_DEDUCTION = 10000.0...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item = 0; 4. while (count < 4) { 5.      cout << "Enter item cost: "; 6.      cin >> item; 7.      item_total += item; 8.      ++count; 9. } 10. int average_cost = round(item_total / count); 11. cout << "Total cost: " << item_total << "\nAverage cost: " << average_cost; (Refer to Code Example 8-1.) If the user enters 5, 10, and 15 at the prompts, the output is: Total...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
Compile and execute the application. You will discover that is has a bug in it -...
Compile and execute the application. You will discover that is has a bug in it - the filled checkbox has no effect - filled shapes are not drawn. Your first task is to debug the starter application so that it correctly draws filled shapes. The bug can be corrected with three characters at one location in the code. Java 2D introduces many new capabilities for creating unique and impressive graphics. We’ll add a small subset of these features to the...
The Business Case for Agility “The battle is not always to the strongest, nor the race...
The Business Case for Agility “The battle is not always to the strongest, nor the race to the swiftest, but that’s the way to bet ’em!”  —C. Morgan Cofer In This Chapter This chapter discusses the business case for Agility, presenting six benefits for teams and the enterprise. It also describes a financial model that shows why incremental development works. Takeaways Agility is not just about the team. There are product-management, project-management, and technical issues beyond the team’s control. Lean-Agile provides...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...