Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question: Write a program that asks the user to enter a number of seconds, and w

ID: 672494 • Letter: Q

Question

Question: Write a program that asks the user to enter a number of seconds, and works as follows:

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 3600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3600, the program should display the number of hours in that many seconds.

There are 86400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86400, the program should display the number of days in that many seconds.


I need help programming this on visual basic, and he is only giving us 1 hour to do it. can someone please help me ?

Time Calculator Create a VB application that lets the user enter a number of seconds and works as 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 min- utes in thar 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.

Explanation / Answer

// ConsoleApplication8.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include <cstdlib>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{

   long int seconds,s,hours;
int days, minutes;

cout << "Enter the number of seconds: ";
cin >> s;
days = s / 60 / 60 / 24;
hours = (s / 60 / 60) % 24;
minutes = (s / 60) % 60;
seconds = s % 60;

cout << days << " days, "<<hours<<" hours," << minutes << " minutes, " << seconds << " seconds"<<endl;

system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote