7. Write a decision statement that evaluates to true if a String variable named
ID: 3917873 • Letter: 7
Question
7. Write a decision statement that evaluates to true if a String variable named answer, equals “No” or the letter “N” in any case (upper or lower).
Your Answer:
8. Write a Java decision statement that will set the variable message to “Nice!” if the variable grade contains a value of 85 or greater and “Try harder!” otherwise.
Your Answer:
12. Write a Java expression that will evaluate to true if the arrays arr1 and arr2 are the same size and false otherwise.
Your Answer:
13. Write a Java method header for a public static method named sumArray that takes in an array of double values as a parameter and returns a single double value.
Your Answer:
Explanation / Answer
7. answer.equals("No") || answer.equals("N") || answer.equals("n")
Any of the above can be true to make the statement true
8. message = (grade >= 85 ? "Nice" : "Try Harder");
If grade is equal to or greater than 85, it will be Nice otherwise it will be Try Harder
12. arr1.length == arr2.length
If both are same, returns True otherwise False
13. public static double sumArray(double[] d)
returning a double value and take an array of doubles
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.