Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

to print

bengesbenges Member Posts: 331
how can i make a simple print function in JAVA?
i need this feature to be print out my weekly report in my assignment,
thanks for helping...


Comments

  • YnotYnot Member Posts: 113
    I personnaly would create an assignment class, in which I would:
    * Declare all variables for your assignment
    * Have a constructor to set the assignmentName and result
    * Have a print method to print out all the variables in the required
    format

    eg:
    public class Assignment{
    int result; // ? I don't know what variables would be
    String assignmentName; // ? used, so I'll just use these...

    Assignment( String s, int r ){
    result = r;
    assignmentName = s;
    }

    Assignment( String s ){
    result = 0;
    assignmentName = s;
    }

    Assignment( ){
    result = 0;
    assignment = "";
    }

    // I L O V E function overloading!

    public putResult( int r ){ result = r; }
    public getResult( ){ result = console.readInt(); }
    : // the same for assignment
    :

    public void printAss(){
    System.out.println( assignment + ": " + result );
    }

    }

    Thats a way you might do it. but there you have a basic idea.

    : how can i make a simple print function in JAVA?
    : i need this feature to be print out my weekly report in my assignment,
    : thanks for helping...
    :
    :
    :


    Regards,
    Ynot
    ____________________________

    Forever trust in who we are,
    And nothing else matters.
    -Metallica_
    ____________________________

  • bengesbenges Member Posts: 331
    : I personnaly would create an assignment class, in which I would:
    : * Declare all variables for your assignment
    : * Have a constructor to set the assignmentName and result
    : * Have a print method to print out all the variables in the required
    : format
    :
    : eg:
    : public class Assignment{
    : int result; // ? I don't know what variables would be
    : String assignmentName; // ? used, so I'll just use these...
    :
    : Assignment( String s, int r ){
    : result = r;
    : assignmentName = s;
    : }
    :
    : Assignment( String s ){
    : result = 0;
    : assignmentName = s;
    : }
    :
    : Assignment( ){
    : result = 0;
    : assignment = "";
    : }
    :
    : // I L O V E function overloading!
    :
    : public putResult( int r ){ result = r; }
    : public getResult( ){ result = console.readInt(); }
    : : // the same for assignment
    : :
    :
    : public void printAss(){
    : System.out.println( assignment + ": " + result );
    : }
    :
    : }
    :
    : Thats a way you might do it. but there you have a basic idea.
    :
    : : how can i make a simple print function in JAVA?
    : : i need this feature to be print out my weekly report in my assignment,
    : : thanks for helping...
    : :
    : :
    : :
    :
    :
    : Regards,
    : Ynot
    : ____________________________
    :
    : Forever trust in who we are,
    : And nothing else matters.
    : -Metallica_
    : ____________________________
    :
    :
    thank for your reply, but what i really mean and needed is that the print function by using printer, how can i manipulate it?

    and also, why isn't the statement.executeQuery(...) return boolean value to true since it found true? where i search the documentation saying it would?

    because i have tested it for many time for the record that can found in the database, but it just won't return the boolean to false if the record is not found! please guide, thanks
  • YnotYnot Member Posts: 113
    : thank for your reply, but what i really mean and needed is that the print function by using printer, how can i manipulate it?


    Woah! I'm in w a y over my head! Sorry dude. I thaught you might
    have meant either something like that or the way I showed. If I had
    known exactly what you meant, I would not have gotten your hopes up...
    with useless info. I'm growing up on classes created by lectureres in
    college, so I have it easy.

    Soory again,
    Ynot.
    ____________________________

    Forever trust in who we are,
    And nothing else matters.
    -Metallica_
    ____________________________

  • Andre YoungAndre Young USAMember Posts: 0

    _____ { http://forcoder.org } free video tutorials and ebooks about { Swift C++ Visual Basic .NET Python JavaScript MATLAB Perl Visual Basic PHP Go PL/SQL Ruby C# Java Assembly R Scratch Delphi Objective-C C F# Scheme Logo Kotlin Crystal COBOL Dart FoxPro VBScript Fortran Apex Lua Erlang ABAP D ML SAS Hack Transact-SQL Bash Alice LabVIEW Clojure Scala Awk Lisp Prolog Ada Julia Rust } _____________

Sign In or Register to comment.