Answer to Question #185495 in Visual Basic for tafadzwa

Question #185495

Get the length and width of a rectangular field. Calculate the area and perimeter and display it. Length 52.5 and width 18.6


1
Expert's answer
2021-04-27T14:54:25-0400
Module Module1


    Sub Main()
        'Get the length and width of a rectangular field
        Console.Write("Enter the length of a rectangular field: ")
        Dim length As Integer = Integer.Parse(Console.ReadLine())
        Console.Write("Enter the width of a rectangular field: ")
        Dim width As Integer = Integer.Parse(Console.ReadLine())
        'Calculate the area and perimeter and display it. Length 52.5 and width 18.6
        Dim area As Double = length * width
        Dim perimeter As Double = 2 * (length + width)
        'display the area of a rectangular field
        Console.WriteLine("The area of a rectangular field: " + area.ToString())
        'display the perimeter of a rectangular field
        Console.WriteLine("The perimeter of a rectangular field: " + perimeter.ToString())


        Console.ReadLine()
    End Sub


End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS