VISUAL BASIC FOR APPLICATIONS PLEASE!
Create an application that lets the user enter a number of seconds and produces output according to the following criteria:
There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds.
There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours in that many seconds.
There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days in that many seconds.
'Vb Code
Module Module1
Sub Main()
Dim sec As Integer
Const MINUTE = 60, HOURS = 3600, DAYS = 86400
'prompt user to enter seconds
Console.Write("Enter a number of seconds: ")
sec = Integer.Parse(Console.ReadLine())
If sec >= 60 And sec < 3600 Then
Dim min = sec / MINUTE
Console.WriteLine("The Minutes: " & min.ToString("F2"))
ElseIf sec >= 3600 And sec < 86400 Then
Dim hour = sec / HOURS
Console.WriteLine("The Hours: " & hour.ToString("F2"))
ElseIf sec >= 86400 Then
Dim day = sec / DAYS
Console.WriteLine("The Days: " & day.ToString("F2"))
End If
'pause
Console.WriteLine("Press any key to terminate...")
Console.ReadLine()
End Sub
End Module
'Output
//If you need any help regarding this solution...... please leave a comment... thanks
Get Answers For Free
Most questions answered within 1 hours.