I need to write a program that reads a text file that contains groups of integers that start with the word "next". For each group, the program computes and writes out the sum of the integers in that group and the average. thare may be any number of groups. here is the example:
Next
12 45 92 -12 31
Next
42 52 68 887
-23 23
245
-50
2
Next
90 93 74 23

Recommended Answers

All 3 Replies

What have you come up with thus far? Show us your code and perhaps we can help you. Or are you looking for a starting point?

i just do not know what to start from???

Well lets think about it logically, what are you wanting to do. Lets set it in steps:

Read text file
Find the word "next"
Pull out the ints
Sum the numbers

So the first thing you'll want to look into is how you are wanting to read the file. Some suggestions are Scanner or BufferedReader

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.