Results 1 to 8 of 8
  1. #1
    sinista is offline Member
    Join Date
    Sep 2009
    Posts
    6
    Rep Power
    0

    Cool minimum,/maximium

    a class(calculate) containing three numbers, use set method to set values(overloading) to instance variables.
    Find the minimum value of all three values
    Find the maximum value of any two values

    Method to :
    Display the three numbers and their maximum value.
    Display the two numbers and the minimum value.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    And?
    (10 chars)

  3. #3
    sinista is offline Member
    Join Date
    Sep 2009
    Posts
    6
    Rep Power
    0

    Default

    can someone please help me with this problem. minimum/maximum value

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    All you've done is post your homework.
    How about giving us what you've managed so far, and asking for help with a particular bit of it? Otherwise we might get the idea that you just want us to do your homewrok for you.

  5. #5
    sinista is offline Member
    Join Date
    Sep 2009
    Posts
    6
    Rep Power
    0

    Default minimum/maximum

    *
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package calcultejava;

    /**
    *
    * @author sinista
    */
    public class calculte {
    int num1,num2,num3,minimum,maximum;
    }
    public calculte(){
    }
    public void setValues(int n1,int n2,int n3, int min, int max)
    {
    num1 = n1;
    num2 = n2;
    num3 = n3;
    minimum = min;
    maximum = max;
    }
    public int getnum1(){
    return num1;
    }
    public int getnum2(){
    return num2;
    }
    public int getnum3(){
    return num3;
    }
    public int getminimum(){
    return minimum;
    }
    public int getmaximum(){
    return maximum;
    }
    public void display(){
    System.out.printLn("The minimum of"+ num1+ ","+ num2+"and"+ num3+"is"+Math.min(num1,num2,num3));
    System.out.printLn("The maximum of"+ num1+ ","+ num2+"and"+ num3+"is"+Math.max(num1,num2,num3));

    }
    }


    THE MAIN CLASS IS BELOW:cool:
    _______________________

    public class CalculteMain{
    public static void main(String args[])
    {
    for (num1); = (min); (num1<=max);(num1++);
    System.out.printLn("The minimum of)

    Calculte num1 = new Number(5);
    num1.display()
    Calculte num2 = new Number(8);
    num2.display()
    Calculte num3 = new Number(9);
    num3.display()
    }

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    And?
    (I seem to be saying that a lot).

    Which bit doesn't work?
    Which bit are you having problems with?
    And you ought to use CODE tags, since it's largely unreadable.

  7. #7
    sinista is offline Member
    Join Date
    Sep 2009
    Posts
    6
    Rep Power
    0

    Default

    i am using netbeans 6.7.1.
    netbeans syntax is saying i need to have a main class but i do, minimum,maximum value not working out.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Format your code!
    Please!
    I refuse to read unformatted mush...

    Does this compile?
    I don't use netbeans (and I would argue you shouldn't either until you're well versed in Java), so you'll have to come up either with compiler errors if it doesn't compile, stack traces if it compiles but doesn't run, or some output that you can point to and say "this isn't right".

    ETA: I've just copy and pasted the first class you've given us here.
    It doesn't compile.

Similar Threads

  1. [SOLVED] Help Finding the Minimum value of an array
    By MSteinman in forum New To Java
    Replies: 18
    Last Post: 04-21-2009, 10:14 AM
  2. Help With Minimum Value
    By Bodomar in forum New To Java
    Replies: 1
    Last Post: 11-07-2008, 05:29 AM
  3. minimum word length in search problematic
    By jocassid in forum Suggestions & Feedback
    Replies: 3
    Last Post: 07-01-2008, 05:24 AM
  4. Replies: 1
    Last Post: 02-16-2008, 10:10 PM
  5. Minimum system requirements
    By coco in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 09:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •