Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please help me with java assignment Your task is to create a program - similar to the exercises that we did in class in order
please help me with java assignment
Your task is to create a program - similar to the exercises that we did in class in order to show how you can code different user created methods. Your program has to be menu oriented with different choices in between the subprograms. 21 Write the Java code for the following methods. To test each method you will also need a test class with a main method. Make sure you test your methods with a variety of test cases. Also, don't forget to include complete comments for each method including any @param and @return comments 1. A method called sumOfNumbersBetween() that finds the sum of the numbers between two integer numbers including the two numbers. For example, sumINumbersBetween(4.7) should retur 22 44+5+6+7). IC 14 IK 21 IA 141 2. A method called distance Between() that finds the distance between two points This method should have 4 parameters: the x and y value of the first point and the x and y value of the second point. For example if you wanted to find the distance between A (1.2) and B(4,6). you would use distanceBetween(1.2.4.6) In this case the method should retum 5. For any math background on the subject please refer to this link IC 14 K 21 IT 14 3. For a positive integer n, the notation nt (read as 'n factorial) is used for the product nx{n-1}*(n-2). *2*1. For example 41=4*3*2*1=24 and 101-10*9*8*7*6*5*4*3*2*123,628,800. Also, by definition Ol=1. Write the code for a method called factorial) that finds the factorial of a positive integer. For example, the following would set answer to 120 answer = factorial(5) As you can see, factorials can get very large so be careful when deciding on the return type for your method and when testing your method. Please make sure that input/output is handled properly on this method since factorials only exist for positive integers. For any math background on the subject please refer to this link 141 IK 121 IA 141 141 50XSE 4. A method of your choice that has at least 2 parameters and has different options of return values. Method has to be different from the methods that we did in class. IC 121 IK 111 IA 11] IT 121 5. A boolean method that has at least 2 parameters and has to be different from them methods we did in class 2] IK 111 TA 111 IT 12] Step by Step Solution
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