Need urgent help in assignment of JAVA, any idea suggestion plz

Discussion in 'Java' started by Aesthete, Jan 5, 2011.

  1. Aesthete

    Aesthete New Member

    Joined:
    Jan 5, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    I need help in my assignment plz. kindly guide me any technique/idea to do the following. m not at advance level of programming.

    The program should take function defnitions and those definitions can be used in future expressions
    for eg:

    def add(x,y)=(x+y)
    >>> ok
    def inv(x)=1/x
    >>> ok
    inv(add(2,2))
    >>> ans : 0.25

    Also four additional commands:
    show; to prints all de?nitions on screen
    save flename; to save all defnitions in a fle
    load flename; to load all defnitions from a fle
    delete funname; to delete the defnition corresponding to the function named funname
     
  2. virxen

    virxen Active Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    28
    start coding the easy part
    create a class and ask the user to give you commands
    post your code here for the rest
     
  3. Aesthete

    Aesthete New Member

    Joined:
    Jan 5, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    Code:
    public class Funcdefin 
    {
        public static void main(String[] args)
        {
        String line=null;
        System.out.println("please enter commands");
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        try
        {
            line = stdin.readLine();
        } catch (java.io.IOException e) 
        {
            System.out.println("Error: Invalid IO operation.");
        }
        System.out.println(line);
        
        }
    }
    
    THIS IS ALL I HAVE SO FAR. PLZ HELP ME OUT. FOLLOWING ARE THE DETAILS THROUGH WHICH IT IS REQUIRED TO BE DONE.

    A function is a labelled tree
    It is a tree with a name
    It also contains unbound variables, i.e. the variables listed in the
    parameter list (and only those ones)
    When a function is used, it is necessary to bound the variables to
    actual values, and then evaluate the tree as any other numerical
    expression

    AND THE REQUIREMENTS ARE

    show prints all definitions on screen
    save filename saves all definitions in a file
    load filename loads all definitions from a file
    delete funname deletes the definition corresponding to the function
    named funname
     
    Last edited by a moderator: Jan 9, 2011
  4. virxen

    virxen Active Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    28

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice