Program to calculate simple interest in vb.net

Vb Program to calculate simple interest. Here mentioned other language solution.

' Include namespace system
Imports System 
'  Vb.net program for
'  Calculate simple interest
Public Class Interest
    ' Method which is take three parameters
    ' And calculates that simple interest
    ' Here time is form in year
    ' rate is form of annual interest rate
    Public Shared Sub simpleInterest(ByVal principle As Double, 
                                     ByVal time As Double, 
                                     ByVal rate As Double)
        ' Display parameters values
        Console.WriteLine("Principal : {0}", principle)
        Console.WriteLine("Time : {0}", time)
        Console.WriteLine("Rate : {0}", rate)
        ' Calculate interest
        Dim amount As Double = (principle * time * rate) / 100
        ' Display amount
        Console.WriteLine("Simple Interest : {0} "&vbLf, amount)
    End Sub
    Public Shared Sub Main(ByVal args As String())
        ' Test Cases
        simpleInterest(1500, 3, 7.3)
        simpleInterest(170.4, 7, 3.4)
    End Sub
End Class

Output

Principal : 1500
Time : 3
Rate : 7.3
Simple Interest : 328.5

Principal : 170.4
Time : 7
Rate : 3.4
Simple Interest : 40.5552



Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2022, kalkicode.com, All rights reserved