# begineer

mubashir
begineer
Posted in : Java Beginners

Q.1.write a program which have 4 integer hard value and its check all four integer number that which have maximum value and which have smaller.??

Q.2.write a program in whch class have two integer value which is hard coted and have 6 method . first method .done a sum of both value and return it. second method done multiplication and return it. 3rd method take modulus and also check which value is greater and which is smaller and also return it. 4th method do division and also check which value is greater and which is smaller and also return it. 5th methid do subtraction and also check which value is greater and which is smaller and also return it. 6th method is check which value is great which integer value we take it in above program which is hardcoted

October 23, 2010 at 3:03 PM

Hi Friend,

```import java.util.*;

public class MaxMin {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int maxNumber = Integer.MIN_VALUE;
int minNumber = Integer.MAX_VALUE;
System.out.println("Enter 4 numbers:");
for(int i=1;i<=4;i++){
int number = input.nextInt();
if (number > maxNumber) {
maxNumber = number;
}
if (number < minNumber) {
minNumber = number;
}

}
System.out.println("Maximum Number = "  + maxNumber);
System.out.println("Minimum Number= "  + minNumber);
}

}
```

Thanks

October 23, 2010 at 3:16 PM

Hi Friend,

```class Calculate{
int i,j;
Calculate(int i,int j){
this.i=i;
this.j=j;
}
return i+j;
}
public int multiply(){
return i*j;
}
public int subtract(){
int result=0;
if(i>j){
result= i-j;
}
else{
result= j-i;
}
return result;
}
public int divide(){
int result=0;
if(i>j){
result= i/j;
}
else{
result= j/i;
}
return result;
}
public int modulus(){
int result=0;
if(i>j){
result= i%j;
}
else{
result= j%i;
}
return result;
}
public int check(){
int greater=0;
if(i>j){
greater=i;
}
else{
greater=j;
}
return greater;
}
public static void main(String[] args){
Calculate c=new Calculate(2,7);
System.out.println("Subtraction= "+c.subtract());
System.out.println("Multiplication= "+c.multiply());
System.out.println("Division= "+c.divide());
System.out.println("Modulus= "+c.modulus());
System.out.println("Greater value= "+c.check());
}
}
```

Thanks

Begineer Help Help Please Thanks A million ) I am using Jcreator
Begineer Help Help Please Thanks A million ) I am using Jcreator  System.out.println(" Income Statement"); System.out.print("Year
set java exe file as background - Java Beginners
set java exe file as background  hi frenz, i am begineer to java. in my application i have a one exe file. now i wanna the file... is closed then v don't continue that application.. can u tell me how java exe file set
about java  hello, being a begineer in Java i would like know that as we read the value entered by user through cin>> in c++ how we did it with java.  Hi Friend, There are lot of ways to input data.You can use
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java begineer programmer i recently started developing programes on NetBeans using the GUI as it is more reliable and efficent - the current program that i am working
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java begineer programmer i recently started developing programes on NetBeans using the GUI as it is more reliable and efficent - the current program that i am working
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java begineer programmer i recently started developing programes on NetBeans using the GUI as it is more reliable and efficent - the current program that i am working
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java begineer programmer i recently started developing programes on NetBeans using the GUI as it is more reliable and efficent - the current program that i am working
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java begineer programmer i recently started developing programes on NetBeans using the GUI as it is more reliable and efficent - the current program that i am working
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java begineer programmer i recently started developing programes on NetBeans using the GUI as it is more reliable and efficent - the current program that i am working