Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## Questions about a Problem I'm trying to solve

[EDIT AND UPDATE]Thank you so much for your response. I was able to solve that using the modulus and if statements and having the != 0 for each number. It works and it's a huge strss reliever. I have another problem now I can't figure out. I've done three more after the last one, and this one seemed to have stumped me. If you can help out with it I will greaty appreciate it. ^^ Thanks again for the reply.

"Design and write a Java application that takes as input an integer larger than 1 and calculates the sum of the squares from 1 to that integer. The output should be the value of the integer and the sum, properly labeled on screen. The application should repeat this process for several input values. Use a sentinel input value to end processing, and use screen input and output."

Really the last part confuses me. Actually I'm not too good with using math in my coding. All help is GREATLY appreciated!

2. ## Re: Questions about a Problem I'm trying to solve

OK use of modulus and division is something that is often taught and if that's what they asked I would recomend you go that route. I'm not going to give the answer but I will help you break the problem down.

First you know it's a 3 digit number.
Second you need to check whether each of these numbers is odd or even.

There are two ways I see that you could do this either write equations that will give you each individual digit and then check if each of those is odd or even.

So in pseudocode
Declare Variable for number and digits
Set Number
Set Digits
Check Each digit for whether it is odd or even
If all are odd display "All Odd"
If all are even display "All Even"
Else Display "Mixed"

Now there is another way but I think learning this way would be more benificial to you. What you need to figure out is what the equation to find each digit. So lets start with the final digit lets say the 3 digit integer is 352 how are we going to get 2?

First of all do you know how modulus works?

3. ## Re: Questions about a Problem I'm trying to solve

Thank you so much for your response. I was able to solve that using the modulus and if statements and having the != 0 for each number. It works and it's a huge strss reliever. I have another problem now I can't figure out. I've done three more after the last one, and this one seemed to have stumped me. If you can help out with it I will greaty appreciate it. ^^ Thanks again for the reply.

"Design and write a Java application that takes as input an integer larger than 1 and calculates the sum of the squares from 1 to that integer. The output should be the value of the integer and the sum, properly labeled on screen. The application should repeat this process for several input values. Use a sentinel input value to end processing, and use screen input and output."

Really the last part confuses me. Actually I'm not too good with using math in my coding. All help is GREATLY appreciated!