java problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alik
    New Member
    • Feb 2007
    • 1

    java problem

    I am having problem with understanding the project's concept and what exactly we need to follow. I don't know if we have to create files and how many. This is my first programing experience and I am not sure what the steps are in developing this program. Please provide me with more details regarding the development steps. I appreciate any help .

    Ali



    Here is the project :

    create a Java program called process.java that opens text files
    and executes simple commands that are read from the files. Your program
    should be able to read a variable number of command files and should
    execute the commands from each in turn.

    Your program should be invoked with the following syntax:
    java process filename1 filename2 ... filenameN

    where each filename# is a complete filename, which may or may not have
    an extension. There can be one or more files specified, and if there are
    none you should print an error. For example, the following is a valid
    command line:
    java process file1 file2.txt file3

    After opening a file your program should print out a status message
    like the following:
    Processing commands from file (filename)

    Each file will contain a sequence of commands, each on its own line.
    The possible commands are as follows:

    add Num1 Num2
    sub Num1 Num2
    mult Num1 Num2

    The numbers (Num1,Num2) can be any valid decimal number, e.g.: (1,5,-4,6.07,-88.23)

    The action of each command is as follows:
    add: Num1+Num2
    sub: Num1-Num2
    mult: Num1*Num2

    For each command you should print out a status message, which includes
    the input numbers and the result of the command. Note that your program
    should allow for any type of white space between the commands and the
    numbers, i.e. spaces, tabs.
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    you need to understand file I/O using java
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

    and command line parameters
    http://java.sun.com/docs/books/tutorial/essential/environment/cmdLineArgs.htm l

    initialy only attempt to specify a single file at the command line then when that is working extend it to multiple filenames

    Comment

    Working...