• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java  RSS feed

 
Dipesh Kumar Kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I faced below problem during my technical test in java. i am not able to solve this problem . so i need help in this question. please reply me...

Write a program to solve the following problem. Your program must accept a filename as the single command-line parameter. The file will contain 7-bit ASCII text and each line may consist of an operation, followed by a colon, followed by a comma-separated list of numbers. For each line, perform the specified operation on the associated numbers and print (to stdout) the operation followed by the result. The operations are 'SUM', 'MIN', 'MAX' and 'AVERAGE' (to determine the sum, minimum, maximum and average respectively).

E.g. for the file containing
SUM: 1, 2, 3
MIN: 4, 3, 2, 40
AVERAGE: 2, 2

your program should print
SUM 6
MIN 2
AVERAGE 2

Your program should handle errors, including malformed input, appropriately.

Thanks
 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would get more attention if you told us what the thread is about.
How would you solve it? Tell us what you think and we’ll respond.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember, your first step is to use pencil and paper (or some electronic equivalent). Write down the steps in a natural language (English, French, Farsi, Afrikaans, Latin...) of your preference. Write down the steps in such a way that a 7 year old child could follow them. Do NOT think in terms of Java, data structures, or classes already found in the API.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!