For Java programming code:
Write methods to add and multiply
1) Two integers
2) Two decimals
3) One integer and one decimal
OUTPUT
public class MyClass {
public static void sumMultiply(int a, int b)
{
System.out.println("Addition is " + (a+b));
System.out.println("Multiplcation is " + (a*b));
}
public static void sumMultiply(float a, float b)
{
System.out.println("Addition is " + (a+b));
System.out.println("Multiplcation is " + (a*b));
}
public static void sumMultiply(int a, float b)
{
System.out.println("Addition is " + (a+b));
System.out.println("Multiplcation is " + (a*b));
}
public static void main(String args[]) {
sumMultiply(3, 4);
sumMultiply(1.5f, 2.4f);
sumMultiply(2, 2.4f);
}
}
// please up vote
Get Answers For Free
Most questions answered within 1 hours.