Question
----JAVA IMPLEMENTATION URGENTLY NEEDED ------ //Ques 3 /** * Computes the standard Rayleigh distribution probability density function (The mathematical function describing the standard Rayleigh distribution
----JAVA IMPLEMENTATION URGENTLY NEEDED ------
//Ques 3
/**
* Computes the standard Rayleigh distribution probability density function (The mathematical function describing the standard Rayleigh distribution is given by: y = [ x / ()^2 ] * e ^ [ (-x^2) / (2^2) ] where =sigma is the scale variable of Rayleigh distribution. The function y is called the probability density function of the standard Rayleigh distribution. Complete the method rayleigh(double x, int sigma) that returns the value of y given by the formula above
* the lab document for the actual formula) with scale parameter.
*
* @param x
* a value
* @param sigma
* scale parameter
* @return the standard Rayleigh distribution probability density function
* evaluated at x
*/
public static double rayleigh(double x, int sigma) {
return 0;
}
//Ques 6
/**
* Returns true if year is a leap year and false otherwise.
*
*
* A year is always a leap year if it is evenly divisible by 400; for all other
* years, a year is a leap year if it is evenly divisible by 4 and not evenly
* divisible by 100. For example:
*
*
* isLeapYear(2000) returns true (2000 is divisible by 400)
* isLeapYear(1900) returns false (1900 is divisible by 4 and 100)
* isLeapYear(2004) returns true (2004 is divisible by 4 but not 100)
* isLeapYear(2005) returns false (2005 is not divisible by 4)
*
*
* @param year
* a year
* @return true if year is a leap year and false otherwise
* @throws IllegalArgumentException
* if year is less than 1582 (the year the Gregorian
* calendar was adopted)
*/
public static boolean isLeapYear(int year) {
return false;
}
//Ques 9
/**
* Returns a string representation of a Range
that is different
* than the one returned by Range.toString
.
*
*
* The returned string has the form "minimum: x, maximum: y"
where
* x is the minimum value of the range and y is the maximum value of the range.
*
* @param r
* a Range instance
* @return a string representation of the range
*/
public static String toString(Range r) {
return false;
}
//Ques 14
/**
* Returns a new list of characters formed by shuffling the
* characters of the given list. It is a precondition that
* the given list t contains at least two elements, and that
* the number of elements is an even number. The list is not
* modified by this method.
*
*
* To shuffle the characters in t, imagine splitting the list
* t in half so that the first (n / 2) characters of t are in
* one sublist, and the remaining (n / 2) characters of t are
* in the second sublist. The new returned list is formed by
* adding the first character of the first sublist to the
* new list, then adding the first character of the second sublist,
* then adding the second character of the first sublist, then
* adding the second character of the second sublist, and so on,
* until all of the characters in the two sublists are added
* to the new list.
*
*
* For example, if t was the list:
*
*
* ['a', 'b', 'c', 'd', 'e', 'f']
*
*
*
* then splitting t into two sublists yields:
*
*
* ['a', 'b', 'c'] and ['d', 'e', 'f']
*
*
*
* Take the first two characters of each sublist and add them to the
* new list:
*
*
* ['a', 'd']
*
*
*
* Then take the next two characters of each sublist and add them to the
* new list:
*
*
* ['a', 'd', 'b', 'e']
*
*
*
* Then take the next two characters of each sublist and add them to the
* new list:
*
*
* ['a', 'd', 'b', 'e', 'c', 'f']
*
*
* @param t a non-null list of characters
* @return a new list equal to the shuffle of the characters in t
* @pre. t is not null
* @pre. t.size() is greater than or equal to 2
* @pre. t.size() is an even number
*/
public static List
}
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