Solved

Time to seconds

Posted on 2000-03-17
13
212 Views
Last Modified: 2010-04-10
I have to write a function which takes as its argument 3 integers representing hours, minutes and seconds. This functions should return a long integer representing the total number of seconds. I have to also write a test driver for this function. Please help!
0
Comment
Question by:essy
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 5

Accepted Solution

by:
Jan Louwerens earned 50 total points
ID: 2629308
long Seconds(int hours, int minutes, int seconds)
{
   return (hours * 3600) + (minutes * 60) + seconds;
}
0
 
LVL 22

Expert Comment

by:nietod
ID: 2629330
We cannot provide answers to school assignments.  That is grounds for removal from this site.  (for both you and the experts involved.)  We can provide only limitied help in accademic assignments.    We can answer specific (direct) questions, like you might ask your teacher.  We can review your work and post suggestions, again, like your teacher might do.

Do you have specific questions?
Do you have any work on this (incomplete even) that we can review?

jlouwere, please make not of this!
0
 
LVL 22

Expert Comment

by:nietod
ID: 2629332
That was supposed to be "make note of this"
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 5

Expert Comment

by:Jan Louwerens
ID: 2629351
yes, I realized that, but I figured pretty much anyone could convert hours/minutes/seconds to just seconds. I purposely left out the test driver part for that reason. But your point is ttill taken.
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 2629586
nietod,

I know that you suggested the academic rule, but as it's worded I don't see where an expert can be held liable for answering a supposed assignment. Here is the text from the guidelines:

"violate the guidelines for academic honesty.  ("Academic Honesty" means performing all academic work without plagiarism, cheating, lying, tampering, stealing, receiving unauthorized or illegitimate assistance from any other person, or using any source of information that is not common knowledge)."

As this is worded, it implies that the onus is on the person asking the question. I searched the site for "Academic Honesty" and only found your two submissions.

This question could be just a question...

Steve
0
 
LVL 22

Expert Comment

by:nietod
ID: 2629643
>> I searched the site for "Academic Honesty"
>> and only found your two submissions

You didn't search it well.   There have been numerious discussions about this topic (including some by the EE advisory board), and my note there is used by several experts in addition to myself and probably appears in several questions every day.

>> As this is worded, it implies that the onus
>> is on the person asking the question.
True.  But that's actually an improvement.  The last time I saw it, it didn't define the term at all.  I complained and this is probably the result.  I'll complain again.  Eventually they'll throw me off.

>> I don't see where an expert can be held
>> liable for answering a supposed assignment
Experts can be (and have been) removed for unethical behavior.  I don't know if any experts have been removed for accademic dishonesty, but they certainly have been warned about it in some instances.

>> This question could be just a question...
It could be, but it is unlikely.  It certainly isn't the question of an experienced programmer.  It is question of a beginner, so whethor or not it is for an assignment, it would be in essy's interest to attempt the work and get feedback, rather than be spoodfeed the answer.
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 2629739
Where is this information you are referring to? If it's not in the posted guidelines --- then it can't be considered to be a rule. If this is a rule then it should be clearly spelled out, not implied or buried in some "discussions"...
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 2629747
The point I'm trying to make is that I shouldn't have to search for a rule that could cause my removal from this site... It must be spelled out in an easy to find place.

Thanks
0
 

Author Comment

by:essy
ID: 2629753
I apologize for not reading the rules of this site carefully. This was my first time asking a question and therefore did not know the dos and don'ts. I'm a begginner in c++ and just needed some help. What I should have done is posted my incomplete work as well, anyway, next time! Thanks jlouwere.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2629899
>> It must be spelled out in an easy to find place.
We're working on it.  It takes time.  There was no official mention of accademic honesty 3 months ago.  One issue is that EE doesn't want to encourage the sort of things they are trying to prevent.  Common problems include questions on writting viruses, on pirating software, on hacking into protected sites etc.  These topics are off limits, but EE doesn't want to spell this out in the agreement because it would probably encourage these questions from people who hadn't thought to ask.

>> I apologize for not reading the rules of this site carefully
No problem.
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 2629973
My point is that you shouldn't be telling experts that they can get removed from the site for answering a question that might me construded as "an assignment" when there isn't anything in the guidelines regarding this... If it should be a rule then say it in the guidelines.

I don't think that this issue can be compared with the destructive programming behaviors such as viruses or hacking through protected sites. That is an abomination that no programmer should endorse or support.

Thanks you for making this site better. But, until it's in writing, it's not a rule and you shouldn't advertise it as a rule...
0
 
LVL 22

Expert Comment

by:nietod
ID: 2630432
>> you shouldn't be telling experts that they
>> can get removed from the site for
>> answering a question that might me
>> construded as "an assignment"
Well, I don't have the authority to say anything official like that.  (As a advisory board member, EEpays a  little more attention to my suggestions than those of the general experts, but I don't have any "power".)  It is meerly a warning that it is ground for removal from the site.  Which is intirely true.  I don't know of a case where anyone was actually removed--not that I would necessarily know if it--but I do no of cases where EE customer support have...repremanded...experts for this.

>> If it should be a rule then say it in the guidelines.
I'll try to get that changed in the next release.  I did mention it in the last release and apparantly they changed it some.  

What I hope to do is have ia a short EE code ethics that mentions this among other things (like not answering a question using the info a previous expert posted in a comment, not answering with a total guess, that sort of thing.)
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 2630474
Well thanks for your efforts. This is a great forum to get help and to learn.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question