Professional Documents
Culture Documents
Apply the concept of class, object and method overloading to write a class to
overload a method num_calc() as follows:
a. void num_calc(int num, char ch) with one integer and one character argument. It
computes the square of an integer if choice is ‘s’ otherwise its cube.
b. void num_calc(int a, int b, char ch) with two integer and one character arguments.
It computes the product of integer arguments if ch is ‘p’ else adds the integers.
void num_calc(String str1, String str2) with two string arguments and prints if the two strings
are equal or not.
2. Apply the concept of class, object and method overloading to write a class to
overload a method generate() as follows:
a. void generate(int num, char ch) with one integer and one character argument. It
computes the cube of an integer if choice is ‘t’ otherwise its square
b. void generate(int x, int y, char ch) with two integer and one character arguments.
It computes the sum of integer arguments if ch is ‘s’ else product the integers.
void generate(String str1, String str2) with two string arguments and prints if the two strings
are equal or not.
3. Write a program to calculate bike rent of parking based on the following information: