wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes challenge!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "challenge!!" Watch "challenge!!" New topic
Author

challenge!!

Zafar Ali
Ranch Hand

Joined: May 11, 2002
Posts: 64
Hi to all
i am sorry to all for disturbing u ppl again and agiain but plz ignore my silly questions and help me these are challenge for you!!!
(Simple Questions).

Q1. To input your age x in years and output the number of minutes you have lived.
Q2. Suppose that since you were born, you have slept an average of 9 hours a day.
Extend your program for problem 1 to output the number of years of your life you have spent asleep.


Zafar <br />***Your behaviour should affect.***
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Hmmm....Rather than simply giving you the code to do this, let's write some pseudocode to get you started. Then, if you have more specific questions (as opposed to "please write this for me"), feel free to ask.
Question 1 Pseudocode
Step 1: Prompt the user for their age (in years).
Step 2: Read an integer from standard input (look into the InputStream class)
Step 3: Multiply that number by the number of days in a year
Step 4: Multiply that number by the number of hours in a day
Step 5: Multiple that number by the number of minutes in an hour
Step 6: Display the result to the user
Hopefully, from this description, you'll also be able to write the pseudocode for the second question as it's not a very big change to this pseudocode.
I hope that helps. If you have any more questions, please ask.
Corey


SCJP Tipline, etc.
Tony Jackson
Ranch Hand

Joined: Feb 23, 2001
Posts: 45
Hi Zafar,
I'm not sure if you have a problem with a java concept or if you just want someone to do your work/homework/whatever for you.
If you ask the question: How do I add two numbers together, it sounds like you want to learn a concept. But if you ask the question "what is the sum of 12 and 5", it just sounds like you want that one answer and don't care about the concept.
Also, your problem had a lot of parts. What do you really need help with, asking the user for input? Doing the math calculation? Changing the math calculation for part B?
If the answer is "everything" then I don't think the question is appropriate for you: you should start with a simpler problem: write a java program that prints out a line of text; then write a program that adds two numbers together; etc.
Tony Jackson
Nazmul Huda Sarkar
Ranch Hand

Joined: Feb 01, 2002
Posts: 317
Oh! I think he is doing fun.....just telling us how much time we spent on sleeping


Nazmul<br />SCJP,SCWCD,IBM OOAD with UML
Arun Pai
Ranch Hand

Joined: Mar 11, 2002
Posts: 143
Zafar,
i am sorry to all for disturbing u ppl again and agiain but plz ignore my silly questions and help me these are challenge for you!!!
(Simple Questions).

OKies We will ignore your silly Questions
-Arun
Lance Titchkosky
Ranch Hand

Joined: Apr 30, 2002
Posts: 36
Your probably better off using the Date (calc number of days from today to the date in the past) class since just doing a simple calculation using the number of days per year doesn't take into account leap years, and your final answer will be wrong.
You could check for leap years yourself if you wanted, a year is a leap year if it is it is exactly divisable by 4, unless it a century year (1800,1900,2000) then its only a leap year if its divisable by 400.
lance
Zafar Ali
Ranch Hand

Joined: May 11, 2002
Posts: 64
Thanx from the deep of my heart to
Corey, Tony, Lance i have solve the problem.
and Nazmul , Arun both are not devote for others and can't feel that how a person feel before SCJP both person are unable to solve others problem plz read my the cote.
thanx :roll:
 
jQuery in Action, 2nd edition
 
subject: challenge!!
 
Similar Threads
strategy pattern:how to call some SuperType mthd. from encapsulated behavior object
Too many getters
Can't believe it.!!
Big O
what are different level in software engineering career?