1. Create the following overloaded functions:
a. void calculate(int x, int y, char ch): with arguments x, y and ch to print the sum of x and y if value of ch is ‘s’ or ‘S’ otherwise print the product of x and y.
b. void calculate(char st, char ch): with two characters st and ch to convert value of st in lowercase if ch is ‘s’ or ‘S’ otherwise convert st in uppercase. Print values of st and ch.
Answers
Answered by
1
Answer:
make use of type casting and switch
example for type casting
class calculate
{
public static void main (String args [])
{
int x =1, y=2, ; char ch;
ch = ( int) x + y;
System.out.println("+ch);
}
}
Similar questions