Question

Use Visual Basic language The function, FindAreaOfTriangle, calculates the area of a triangle given the base...

Use Visual Basic language

The function, FindAreaOfTriangle, calculates the area of a triangle given the base and height. Write code that calls the function with: Base = 8; Height = 16.3 and returns the answer to dblAreaOfTriangle.

    Function FindAreaOfTriangle(dblBase As Double, dblHeight As Double) As Double

        Dim dblArea As Double

        dblArea = (dblBase * dblHeight) / 2

        Return dblArea

    End Function

Display keyboard shortcuts for Rich Content Editor

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per requirement submitted above kindly find below solution.

Here new Console Application in VB is created using Visual Studio 2019 with name "AreaCalculator".This application contains a module with name "Module1.cs".Below is the details of this module.

Module1.vb :

Module Module1 'VB Module

Sub Main() 'Main procedure
'declaring variable to store area of triangle
Dim dblAreaOfTriangle As Double
'call method and store area in the dblAreaOfTriangle variable
dblAreaOfTriangle = FindAreaOfTriangle(8, 16.3)
'print area of triangle
Console.WriteLine("Area of Triangle with 8 base and 16.3 height is " & dblAreaOfTriangle)
End Sub
'Function to calculate are of triangle
Function FindAreaOfTriangle(dblBase As Double, dblHeight As Double) As Double
'declaring variable dblArea of Double type
Dim dblArea As Double
'calculate are of triangle
dblArea = (dblBase * dblHeight) / 2
'return are of triangle
Return dblArea
End Function
End Module

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

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

Screen 1:

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

Add a comment
Know the answer?
Add Answer to:
Use Visual Basic language The function, FindAreaOfTriangle, calculates the area of a triangle given the base...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 4 Write a program that display the area of a triangle. The program calls the...

    Question 4 Write a program that display the area of a triangle. The program calls the following two functions: .getBaseHeight - This function uses a reference parameter variables to accept a double arguments base and height. This function should ask the user to enter the triangle's buse and height. Input validation: base and height should be positive numbers. calArea - This function should accept the triangle's base and height as arguments and return the triangle's area. The area is calculated...

  • Using the c++ language 1) Create a function that calculates the area of a circle "circeArea...

    Using the c++ language 1) Create a function that calculates the area of a circle "circeArea ()". The function should take a single float parameter radius and return a float area. 2) Create a function to calculate the area of a rectangle. 3) Creat a function to calculate the area of a triangle when given base and height as parameters provided by the user.

  • Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function...

    Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function that does the following: Prompts the user, using two input boxes, for the height and the radius of the base of a cone. Calls a function named cone_volume and passes the two values to it. Receives a value back from the function and displays it in a message to the user. Create a function named cone_volume that does the following: Receives the two values...

  • Problem: Given information about a circle, rectangle and a triangle, calculate the area of the shape...

    Problem: Given information about a circle, rectangle and a triangle, calculate the area of the shape from the information supplied. Write pseudocode to solve this problem and write a Python program that asks the user to input the required information for a shape and then calculates the area of the shape. Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1...

  • Q2) Interface Create a program that calculates the perimeter and the area of any given 2D...

    Q2) Interface Create a program that calculates the perimeter and the area of any given 2D shape. The program should dynamically assign the appropriate calculation for the given shape. The type of shapes are the following: • Quadrilateral 0 Square . Perimeter: 4xL • Area:LXL O Rectangle • Perimeter: 2(L+W) • Area:LxW Circle Circumference: I x Diameter (TT = 3.14) Area: (TT xD')/4 Triangle (assume right triangle) o Perimeter: a+b+c O Area: 0.5 x base x height (hint: the base...

  • Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it...

    Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it to a size equal to an assigned value of a variable, populate the array with a series of random numbers, output the array to a message box and to a worksheet. Instructions: - Review the variables already declared. You won't need others. - See comments in the code that will act as your guide. Add new code directly after each comment. - Assign a...

  • PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs...

    PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs to:             -define a recursive procedure/function and call it.             -use syscall operations to display integers and strings on the console window             -use syscall operations to read integers from the keyboard. Assignment Description: Implement a MIPS assembly language program that defines "main", and "function1" procedures. The function1 is recursive and should be defined as: function1(n) = (2*n)+9                      if n <= 5              =...

  • I am trying to build a program in Visual Basic that allows user to enter an...

    I am trying to build a program in Visual Basic that allows user to enter an objects mass and velocity and to display the Kinetic energy. The application should have a function KineticEnergy that accepts a moving objects mass and velocity as arguments. The function should return the objects KE. i get these three errors when trying to run the program I need help how would I fix this so it runs successfully? Thanks in advance! Start 16 ml.vb* +...

  • Define an interface named Shape with a single method named area that calculates the area of...

    Define an interface named Shape with a single method named area that calculates the area of the geometric shape:        public double area(); Next, define a class named Circle that implements Shape. The Circle class should have an instance variable for the radius, a constructor that sets the radius, an accessor and a mutator method for the radius, and an implementation of the area method. Define another class named Rectangle that implements Shape. The Rectangle class should have instance variables...

  • C++ //get_letter_grade.h /* Write a function gpa_to_letter_grade that returns a string and accepts a double gpa...

    C++ //get_letter_grade.h /* Write a function gpa_to_letter_grade that returns a string and accepts a double gpa parameter */ //get_letter_grade.cpp /* Write function code for gpa_to_letter_grade that returns a string and accepts a double gpa parameter YOU MUST USE A SWITCH STATEMENT Given a double 3.5 returns the string A TIP: You'll have to convert the double to an int using multiplication Table 3.5 to 4 returns an A 3.0 to 3.49 returns a B 1.7 to 2.99 returns a C...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT