Question: Create a package called Q 3 . Create a java class called AdditionOverload which will use the header and footer with your information that you
Create a package called Q
Create a java class called AdditionOverload which will use the header and footer with
your information that you created in Q
Define three overloaded methods for addition.
o The first of which will accept two strings as argument and return the added strings
when called. The method must have the following header:
public static dataType addValsdataType str dataType str;
o The second one will accept two real numbers as argument and return the added
result when called. The method must have the following header:
public static dataType addValsdataType num dataType num;
o The third one will accept two characters as argument and return the resultant
character after adding those two when called. The method must have the following
header:
public static dataType addValsdataType char dataType char;
Define the main method with the following specifications:
o Call your myHeader method available in MyMethods class in package Q with
appropriate arguments, after following the same formalities as you did in Q
o Prompt the user to enter two real numbers see the sample output Call the
addVals method to add these numbers, and print their sum in the main using printf method that should print the result with up to two decimal places see the
sample output
o Prompt the user to enter two characters. Call the addVals method to add these
two characters, and print the resultant character along with the integer equivalent
value in the main using printf method as shown in the sample output. You can
crosscheck your result from the Unicode table Prompts the user to input a full name. Watch out: as discussed in the class with
examples Unit here you need to clear the buffer before accepting the input
using nextLine method.
o Call the addVals method to add the strings My name is or I am ; your calland
the userentered full name from above, and print the added strings in the main
using printf method.
o Call myFooter method with appropriate argument.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
