Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-10-2008, 02:52 PM
Zebra's Avatar
Member
 
Join Date: Apr 2008
Location: Louisville, Indiana/Kentucky
Posts: 64
Zebra is on a distinguished road
[SOLVED] Integers (averages and remainders)...need help
Hey everybody. I have a new question today that I need help with. Here is the question.

"Make a program that asks the user to input n-integers. And, find the average of the remainders, when each is divided by 4."

...hopefully somebody can help me out. Thanks for your time.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-10-2008, 03:10 PM
Zebra's Avatar
Member
 
Join Date: Apr 2008
Location: Louisville, Indiana/Kentucky
Posts: 64
Zebra is on a distinguished road
Alright my teacher just ended up giving me the code. Lol. Here is the code, and mods you can put solved on the title.

Code:
import java.util.Scanner; class Remainders { public static void main(String args[]) { Scanner scan = new Scanner(System.in); double avg; double sum = 0; int num; System.out.println("How many numbers?"); int n = scan.nextInt(); for(int i = 1; i <= n; i++) { System.out.println("Enter number " + n); num = scan.nextInt(); sum = sum + num % 4; } avg = sum/n; System.out.println("The average of the remainders is " + avg); } }
__________________
I am a Java n00b.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 05:40 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 740
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
That's strange.. what is the teacher's purpose is handing out the code like this without a student's attempt ? I question his/her pedagogy.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on July 13, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 02:58 PM
Zebra's Avatar
Member
 
Join Date: Apr 2008
Location: Louisville, Indiana/Kentucky
Posts: 64
Zebra is on a distinguished road
Because that was review and we are having a test today.
__________________
I am a Java n00b.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-16-2008, 02:26 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 509
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Maybe, you forgot to ask a question...

Quote:
Hey everybody. I have a new question today that I need help with. Here is the question.

"Make a program that asks the user to input n-integers. And, find the average of the remainders, when each is divided by 4."
Maybe, "Can you show a program that is similar to program that i was specified? i like to have an experiment on it to be able to learn java...

if you feel that you are a noob, well, don't say that....
You might say, i am a beginner, not a noob...

And our experts here, are also came from a beginner, so, you have more chance to be an expert too.. like them... just have patience...

have some experiments on the code, maybe your source is the book or the net....

write it, predict, code it and realize.
sukatoa
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Averages of user inputed values (Need Help) Zebra New To Java 2 04-16-2008 02:51 PM
Reading Integers from a text file tress New To Java 3 04-03-2008 04:48 AM
Random Integers www.kwalski.com Java Applets 8 12-09-2007 06:49 PM
Convert roman numerals to integers Felissa Advanced Java 2 07-02-2007 12:27 AM
Finding Median of X Integers Hasan New To Java 1 05-31-2007 05:12 PM


All times are GMT +3. The time now is 07:51 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org