-
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.
-
-
can someone please help me with this problem. minimum/maximum value
-
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.
-
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()
}
-
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.
-
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.
-
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.