Answered step by step
Verified Expert Solution
Question
1 Approved Answer
9 10 11 12 13 12 3 45 8 A package tests.console.week10; public class Function02Test { + public static double add(int x, int y)
9 10 11 12 13 12 3 45 8 A package tests.console.week10; public class Function02Test { + public static double add(int x, int y) { return x + y; } public static double divide (int x, int y){ if (x == 0) throw new IllegalArgumentException("Cannot Divide by Zero!"); return (double) y / x; 14 } 15 16 + public static double multiply (int x, int y) { return x * y; } 19 20 + public static double subtract (int x, int y) { return x - y; } 23 24 25 A public static void main(String[] args) { 26 //TODO: How would you test these functions? 27 } 28 29 30 31 } 32 Objective: The purpose of this exercise is to practice the use of functional programming by using lambda expressions and method references to solve problems. For more information on functional programming see Lecture Notes 06: Functional Programming Where to find Math Review Worksheet in my-api activities > Act-01-Math-Review Where to find the starter code in my-api package.interface: functions.F1 package.interface: functions.F2 package.interface: functions.F3 package.class: tests.console.week05.Function01Test package.class: tests.console.week05.Function02Test Instructions: Implement the following operations as anonymous functions and display the output with proper formatting in the output console. Select the correct Functional Interface from the OneArgFunction, TwoArgFunction, or ThreeArgFunction. You are to design and implement both the anonymous functions and the higher order functions to be used to carry out the results described below. You are to come up with your own test input and output. Again, display with elegant formatting with an end user in mind! Canvas Task List Complete from your "my-api" activities folder the math review and submit as pdf. You can find a pdf version in your GitHub repo. GOTO activities > Act-01-Math-Review. You are only allowed one PDF File for upload. GitHub Task List Display the use of the square of a value using anonymous functions. Display the use of addition, subtraction, multiplication and division of two integers using anonymous functions. Display the results of calculations for the volume of a cylinder of an integer radius and height using anonymous functions. Display the results of calculations for the volume of a 3D box of an integer width, length and height using anonymous functions. Display the results of calculations for the volume of a sphere of an integer radius using anonymous functions. Print your output to the console, take screen shots and include them in your pdf submission. package functions; public interface F3 { double f(int x, int y, int z); e} public interface F2 { double f(int x, int y); e} public interface F1 { double f(int x); } 9 10 11 12 13 12 3 45 8 A package tests.console.week10; public class Function02Test { + public static double add(int x, int y) { return x + y; } public static double divide (int x, int y){ if (x == 0) throw new IllegalArgumentException("Cannot Divide by Zero!"); return (double) y / x; 14 } 15 16 + public static double multiply (int x, int y) { return x * y; } 19 20 + public static double subtract (int x, int y) { return x - y; } 23 24 25 A public static void main(String[] args) { 26 //TODO: How would you test these functions? 27 } 28 29 30 31 } 32 Objective: The purpose of this exercise is to practice the use of functional programming by using lambda expressions and method references to solve problems. For more information on functional programming see Lecture Notes 06: Functional Programming Where to find Math Review Worksheet in my-api activities > Act-01-Math-Review Where to find the starter code in my-api package.interface: functions.F1 package.interface: functions.F2 package.interface: functions.F3 package.class: tests.console.week05.Function01Test package.class: tests.console.week05.Function02Test Instructions: Implement the following operations as anonymous functions and display the output with proper formatting in the output console. Select the correct Functional Interface from the OneArgFunction, TwoArgFunction, or ThreeArgFunction. You are to design and implement both the anonymous functions and the higher order functions to be used to carry out the results described below. You are to come up with your own test input and output. Again, display with elegant formatting with an end user in mind! Canvas Task List Complete from your "my-api" activities folder the math review and submit as pdf. You can find a pdf version in your GitHub repo. GOTO activities > Act-01-Math-Review. You are only allowed one PDF File for upload. GitHub Task List Display the use of the square of a value using anonymous functions. Display the use of addition, subtraction, multiplication and division of two integers using anonymous functions. Display the results of calculations for the volume of a cylinder of an integer radius and height using anonymous functions. Display the results of calculations for the volume of a 3D box of an integer width, length and height using anonymous functions. Display the results of calculations for the volume of a sphere of an integer radius using anonymous functions. Print your output to the console, take screen shots and include them in your pdf submission. package functions; public interface F3 { double f(int x, int y, int z); e} public interface F2 { double f(int x, int y); e} public interface F1 { double f(int x); }
Step by Step Solution
★★★★★
3.42 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started