/**

* Design a class to overload a function num_calc() as follows:

*

* void num_calc(int num, char ch) with one integer argument and one char

* argument, computes the square of integer argument if choice ch is 's'

* otherwise find its cube.

*

* void num_calc(int a, int b, char ch) with two integer arguments and

* character argument. It computes the product of integer arguments if ch

* is 'p' else adds the integers.

*

* void num_calc(String s1, String s2) with two string arguments, which

* prints whether the strings are equal or not

*

*/

public class questionSEVEN2009{

public void num_calc(int num, char ch)

{

if(ch=='s')

{

int square=num*num;

System.out.println("The square of the number is = "+ square);

}

else

{

int cube=num*num*num;

System.out.println("The cube of the number is = "+ cube);

}

}

public void num_calc(int a, int b, char ch)

{

if(ch=='p')

{

int product=a*b;

System.out.println("The product of the two numbers is = "+ product);

}

else

{

int sum=a+b;

System.out.println("The sum of the two number is = "+ sum);

}

}

public void num_calc(String s1, String s2)

{

if(s1.equals(s2))

{

System.out.println("The two strings are equal");

}

else

{

System.out.println("The two strings are not equal");

}

}

}

Thanks for posting the exact details,its really a good information

ReplyDeletecbse result 2016

ReplyDeleteThanks for providing a good details,its a nice information

icse results 2016

You are great

ReplyDeleteWhy is there no public static void main?

ReplyDelete