/**
* 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");
}
}
}
You are great
ReplyDeleteWhy is there no public static void main?
ReplyDeleteblah blah blah
ReplyDeleteDAMN.......JUST GO AND FUCK OFF>>
ReplyDeleteDo u know how to do programmming .Seriously u r a big fool..
DeleteClass overload
Delete{
Void num_calc(int num,chat ch
{
If (ch=='S')
{
system.out.println (num*num);
}
else
{
system.out.println (num*num*num);
}
}
Void num_calc (int a,int b,char ch)
{
if (ch=='P')
{
System.out.println(a*b);
}
else
{
System.out.println (a+b);
}
}
Void num_calc (string S1,strong S2)
{
If (S1 compare to (S2)==0)
{
System.out.println ("THEY ARE EQUAL");
}
else
{
system.out.println ("THEY ARE NOT EQUAL");
}
}
}
This is the correct way to program
DeleteYes I know I am teacher of computer applications for icse in doddaballapur in ADITYA PUBLIC school
DeletePlease you y\teach us to FKOF .As he is a champion in programing,you may be the same in F**king off yourself...
Deleteall the keywords are wrong.. class, public, void.. they are case sensitive..
DeleteThanks really needed a help in this😉
ReplyDeleteThanks really needed a help in this😉
ReplyDeleteall the programs are wrong u failures specially that chutiya teacher from Aditya public schoo,dodbellapur
ReplyDelete