posted 15 years ago
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.
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.***
posted 15 years ago
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
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
posted 15 years ago
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
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
posted 15 years ago
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
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
Posts: 64
posted 15 years ago
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:
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:
Zafar <br />***Your behaviour should affect.***
Get out of my mind! Look! A tiny ad!
ScroogeXHTML 7.1  RTF to HTML5 / XHTML converter
https://coderanch.com/t/690611/ScroogeXHTMLRTFHTMLXHTMLconverter
