Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JavaExercises.java has 4 different methods for you to complete: makeDice: This method takes returns a new array of integers [ 1 , 2 , 3

JavaExercises.java has 4 different methods for you to complete:
makeDice: This method takes returns a new array of integers [1,2,3,4,5,6].
takeOrder: This method takes a list String and returns a new array containing the orders of the customer. If the customer is Ergun, you should return an array of Strings ["beyti", "pizza", "hamburger", "tea"] in that order. If the customer is Erik, you should return an array of Strings ["sushi", "pasta", "avocado", "coffee"]. In any other case, return an empty String array of size 3.
NOTE: == behaves strangely with Strings for reasons well see later in the course. You should check strings s1 and s2 for equality using s1.equals(s2) in Java.
findMinMax: This method takes an int[] array and returns the the positive difference between the maximum element and minimum element of the given array. You may assume the input array is nonempty.
hailstone: This method takes an int n as input and returns its hailstone sequence as a list of integers. The hailstone sequence is defined by the following procedure: pick a positive integer n as the start. If n is even, divide n by 2. If n is odd, multiply n by 3 and add 1. Continue this process until n is 1.
You should compute this using recursion with the provided helper method hailstoneHelper.
For this part, you can import List and ArrayList.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

How would you use dup2 to redirect standard input to descriptor 5?

Answered: 1 week ago

Question

9. Make sure goals are internalized and accepted by the athlete.

Answered: 1 week ago