• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 76845
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13081
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Squanch that. And squanch this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic