Results 1 to 8 of 8
Thread: minimum,/maximium
- 09-30-2009, 04:48 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 6
- Rep Power
- 0
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.
- 09-30-2009, 05:40 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
And?
(10 chars)
- 09-30-2009, 05:49 PM #3
Member
- Join Date
- Sep 2009
- Posts
- 6
- Rep Power
- 0
can someone please help me with this problem. minimum/maximum value
- 09-30-2009, 05:56 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 10-01-2009, 03:17 PM #5
Member
- Join Date
- Sep 2009
- Posts
- 6
- Rep Power
- 0
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()
}
- 10-01-2009, 03:21 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 10-01-2009, 04:54 PM #7
Member
- Join Date
- Sep 2009
- Posts
- 6
- Rep Power
- 0
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.
- 10-01-2009, 05:07 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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
-
[SOLVED] Help Finding the Minimum value of an array
By MSteinman in forum New To JavaReplies: 18Last Post: 04-21-2009, 09:14 AM -
Help With Minimum Value
By Bodomar in forum New To JavaReplies: 1Last Post: 11-07-2008, 04:29 AM -
minimum word length in search problematic
By jocassid in forum Suggestions & FeedbackReplies: 3Last Post: 07-01-2008, 04:24 AM -
Recursive Method ==> find minimum value from array
By NatNat in forum New To JavaReplies: 1Last Post: 02-16-2008, 09:10 PM -
Minimum system requirements
By coco in forum New To JavaReplies: 1Last Post: 07-31-2007, 08:19 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks