- Parent Category: Programming Assignments' Solutions
We Helped With This JAVA Programming Homework: Have A Similar One?
|More Info||Java Solutions|
Chapter 3 Project Fall 2016
Using techniques from Chapters 1-3 only: This project must be submitted no later than Thursday, December 8, midnight. Do the programming well in advance of the deadline so you can make sure the code works. There is no late submission after the deadline; you only have one chance to submit. You must paste a copy of the code (without line numbers) into the submission and attach the correct java file. [Brackets] and font are not reproduced, they indicate instructions. Identifiers in the instructions are not necessarily formatted correctly.
This program must have two method calls with actual parameters to a method that will return the larger of the two absolute values of the formal parameters and output that value. It will do this twice, with different parameters so that the returned value will change with each method call. All values are integer. You must use the following math classes: max and abs.
1. Create a program called Chapter 3 Project
Place comments at the top of the file with your name, the date and the title (the same as the class name) and your section at the beginning of the file.
2. In the main method declare integer variables [number1] with a value of  and [number2] with a value of 
3. In the main method place a method call to the larger abs val method (see step 5) that will use Use number1 and number2 as the actual parameters. After this, still inside the main method, output the returned value from the method in a single println statement
still in the main method, place another method call using the literal [-13] for the first parameter and the
previously declared variable number2 for the second parameter.
Output this returned value from the method in a single println statement, still in the main method.
5. The called method will be named larger abs val. It will take two integers as parameters (use any correctly formatted names you wish) and returns the larger of the two absolute values using the correct math classes for absolute value and for the maximum.
Allow yourself plenty of time to do this, test step by step, and be prepared to look at page 155 and 159. You will have to use multiple parenthesis in the right sequence to accomplish this project.
You can do steps 3 and 4 either by having a variable derive its value from a method call to the returnable method, then outputting the variable or by combining the method call and the output in one statement.
Assign to a
variable the value of the returned value using a method call
Combine the output and the method call into one statement, without using a variable
In other words, you may do the output and method call combined or separately in the main method.
In the called method you may either store the result in a variable that is returned or have the method return the result of the correct expression to generate the larger of the absolute value of the two parameters. No loops are used.
If you do not use a returnable method, but use parameters and put the output in the called method to get the output and the program still compiles, you will lose 10 points.
You must use the two math classes to get the result. If you just output the literals you will lose 20 points