Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Upload java with a main method similar to below: public static void main(String[] args) { int[] array = {12, 7, -1, 25, 3, 9}; int[]

Upload java with a main method similar to below: public static void main(String[] args) { int[] array = {12, 7, -1, 25, 3, 9}; int[] list1 = {16, 12, 22, 14}; int[] list2 = {46, 25, 19, 7, 4, 1}; int score = 0; // Part A. if (max(array)==25) score+=5; // Part B. if (!isDescending(list1)) score+=5; if (isDescending(list2)) score+=5; System.out.println(score); // 15 points is a good start } 

A. Write a method named max that accepts an array of integers as a parameter and returns the maximum value in the array. For example, if the array passed stores {12, 7, -1, 25, 3, 9}, your method should return 25. You may assume that the array contains at least one element.

B. Write a static method named isDescending that accepts an array int[] as a parameter and returns true if the list is in decreasing order and false otherwise. For example, if arrays named list1 and list2 store {16, 12, 22, 14} and {46, 25, 19, 7, 4, 1} respectively, the call isDescending(list1)return false, and isDescending(list2) returns true. You may assume that the array contains at least one element.

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

More Books

Students also viewed these Databases questions