Question: Class ClassA contains a static method that computes and returns the sum of three integers. Its signature is: public static int addThree(int x, int y,

Class ClassA contains a static method that computes and returns the sum of three integers. Its signature is: public static int addThree(int x, int y, int z)

  • Note: There are no keyboard input statements in addThree() and no print statements. The method merely adds the three values sent to it by the calling method and returns their sum to that method.

Frank is writing a separate Java class named ClassATest that will use this method. In main() of his program he has had the user input three int values; these are stored in int variables nr1, nr2 and nr3. You are to write one (or more) statements for main() that call addThree() to sum the users three values; the returned value will be printed by main().

  • You are not writing main(); just write one (or more) statements that perform the required task.
    • Write your statement(s) exactly so that they can be cut and pasted directly into main() and the program will operate as desired.
  • Do not worry about any fancy formatting for the information printed. Just be sure that your statement(s) use ClassAs addThree() method to add the values and that the values are printed once execution returns to main().

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!