Answered You can hire a professional tutor to get the answer.

QUESTION

Create a method named getOperands. This method does not return a value. In this method, prompt the user twice. At the first prompt, ask them to...

1. Create a method named getOperands.  This method does not return a value.  In this method, prompt the user twice.  At the first prompt, ask them to enter a double variable.  Name it operand1.  At the second prompt, ask them to enter another double variable.  Name it operand2.  Use suitable data validation to ensure the variables receive a double value.  Another data validation is that operand1 and operand 2 use a positive value of at least 2.00 and less than 40.00.  Another data validation is that operand1 is less than or equal to the value in operand2.  Keep prompting the user, if necessary, until all data validations are passed. 

2.  Now that data validations have been enforced, from getOperands, pass both double variables to a method named calcPercentage.  This method does not return a value.  It should display the first received value (i.e. operand1's value) as a percentage of the second received value (i.e. operand2's value).  For example, if the method receives numbers of 2.0 and 5.0, the method should output the following to the command line: "The value of 2.0 is X percent of 5.0." where X is the percentage. 

3.  Use method overloading by creating three methods, each named buildName.  The first version of buildName should accept two String values named nameFirst and nameLast.  These are assigned by you in the main method; no user input is needed.  The method should return a String of the name parts in reverse order, separated by a comma and space.  For example, if the first version of buildName receives "Santa" and "Claus", it should return the following value:"The full name reversed is:  Claus, Santa" 

4.  The second version of buildName should accept a String value named nameFirst, a character value named nameMI, and a String value named nameLast.  These are assigned by you in the main method; no user input is needed.  The method should return a String of the name parts in reverse order, separated by a comma and space.  Append a period for the middle initial.  For example, if the second version of buildName receives "Santa", "Q", and "Claus", it should return the following value:"The full name reversed is:  Claus, Santa Q." 

5.  The third version of buildName should accept a String value named nameFirst, a character value named nameMI, a String value named nameLast, and an integer representing an age.  These are assigned by you in the main method; no user input is needed.  The method should return a String of the name and age parts in reverse order, separated by a comma and space.  Append a period for the middle initial and include the age.  For example, if the third version of buildName receives "Santa", "Q", "Claus", and 42, it should return the following value:"The full name reversed and age are:  Claus, Santa Q. (42 years old)" 

6.  Call each of the methods above from the main method.  The pseudocode for the main method will be as given below. 

    Get the operands and ensure data validations are passed    Calculate the percentage of the operands    Output the reversed full name and age, depending on the values being provided

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question