The Artima Developer Community
Sponsored Link

Java Answers Forum
NEED help with a simple program

1 reply on 1 page. Most recent reply: Apr 16, 2003 3:09 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
ry

Posts: 1
Nickname: ryry
Registered: Apr, 2003

NEED help with a simple program Posted: Apr 16, 2003 10:43 AM
Reply to this message Reply
Advertisement
I CANT FIGURE IT OUT

Design, code and test a Java program which will perform the following:

Read in a series of positive integers in the range of 1-100 (terminated with a negative number) and report the frequency of each number input. For example, the following input:

5 8 5 90 5 8 90 8 16 -#

would result in the following output:

90: 2
16: 1
8: 3
5: 3

Note the report is in descending order and reports only those numbers that have been entered.

File I/O can be performed using the class file FileIn.class. A sample routine that employs the methods necessary for the open, read and close operations can be found in TestFileIn.java. Sample data set assn7.txt.


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: NEED help with a simple program Posted: Apr 16, 2003 3:09 PM
Reply to this message Reply
Did you try it, yet? I think an answer to this exact question (probably someone in your class or from last semester) was posted in this forum a while back. It's very easy to do using a HashMap.

Flat View: This topic has 1 reply on 1 page
Topic: Java mail - unknown host Previous Topic   Next Topic Topic: Serious package misunderstanding!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use