•

Check out our Community Blogs

Register and join over 40,000 other developers!

### Recent Blog Entries

• phi

I love this community !

• JackJames

hi i am jack i am seo expert jack james would love you to read new post

# Writing a time calculator in Pseudocode

pseudocode programming python help

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

### #1 SoloDoloPyro

SoloDoloPyro

CC Lurker

• New Member
• 6 posts

Posted 10 September 2015 - 01:34 PM

I am taking a computer programming logic course and I have an assignment that is asking me to write a time calculator in pseudocode and in python I have no clue how to even start the coding could someone please help me.

The instructions for the assignment is for me to design a program that asks the user to ener 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 then 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 eqial to 3,600, the program should display the number of hours in that many seconds.
• There are 86,400, the program should display the number of days in that many seconds.

### #2 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 11 September 2015 - 04:36 AM

What do you have so far? Where are you stuck?

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### #3 SoloDoloPyro

SoloDoloPyro

CC Lurker

• New Member
• 6 posts

Posted 11 September 2015 - 07:33 PM

//Constant
Constant Integer MINUTES = 60
Constant Integer HOUR = 3600
Constant Integer DAY = 86400

//Local Variable
Declare Real secs
Declare Real ins_day
Declare Real ins_hour
Declare Real ins_minute

//Enter Number of seconds
Display "Please enter a number of seconds"
input secs

// Set Minute, Hour, Day
Set ins_day = secs / DAY
Set ins_hour = secs / HOUR
Set ins_minute = secs / MINUTES

// Show results
Display "Days ", ins_day, " Hours ", ins_hours, " Minutes ", ins_minute

### #4 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 12 September 2015 - 01:35 PM

Close, except you should subtract out the days before calculating the hours and minutes. You should probably also report the seconds.

For example, if I input 578925, your logic will calculate (ignoring decimals):

ins_day = 578925 / 86400 = 6

ins_hour = 578925 / 3600 = 160

ins_minute = 578925 / 60 = 9648

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### #5 SoloDoloPyro

SoloDoloPyro

CC Lurker

• New Member
• 6 posts

Posted 12 September 2015 - 08:28 PM

How would I subtract out the days? And how would I show the seconds

### #6 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 14 September 2015 - 03:25 PM

if one day is 86400 seconds, how many is 6 days?

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### #7 CurbPaintingcom

CurbPaintingcom

CC Lurker

• New Member
• 4 posts

Posted 14 September 2015 - 03:52 PM

518,400. Now for the big math question...If the earth was a perfect sphere (no mountains or valleys) and you tied a string around the equator tight with no slack, then added 10 feet more string and distributed the slack evenly across the earth, in the space created between the string and the ground would you be able to:

a] Walk under it

b] Crawl under it

c] Barely be able to slide a piece of paper under it

?? ??

Edited by CurbPaintingcom, 14 September 2015 - 03:53 PM.

### #8 SoloDoloPyro

SoloDoloPyro

CC Lurker

• New Member
• 6 posts

Posted 15 September 2015 - 05:35 PM

if one day is 86400 seconds, how many is 6 days?

I'm not sure the assignment only calls for one day

### #9 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 15 September 2015 - 06:47 PM

I'm not sure the assignment only calls for one day

It's a math question. Answer it.

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### #10 SoloDoloPyro

SoloDoloPyro

CC Lurker

• New Member
• 6 posts

Posted 21 September 2015 - 07:14 PM

518400

### #11 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 22 September 2015 - 04:17 AM

so of the 578925 seconds, 518400 are the "days" portion. So how many are left for the hours portion?

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download