DOC PREVIEW
Princeton COS 126 - Function Activity - 2.1

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

COS126 Function Activity - 2.1• Group Activity: Arrays, Standard Input, Functions (Static Methods)1. Write a program Maxi which inputs three integers x, y, z from standard input,and calls a function max3() which takes 3 integer arguments and returns the value ofthe largest one. Print the largest integer. (Assume the function max3 is in the classMaxi.)public class Maxi {// methods will go herepublic static void main(String[] args) {// Input three integers from standard input// Call the function max3(a, b, c) and print the result}}2. Write the function max3() to return the largest of three integers. (Exercise 2.1.1)public static __________ max3(___________________________________________) {}13. Write another function max3() to return the largest of three doubles. (Exercise 2.1.1)public static __________ max3(_________________________________) {}4. Write a method reverse1() that takes a String array as an argument, and returns anew String array which holds the reverse of the argument array. DO NOT ALTER theoriginal array. ( Web Exercise 2.1.35)public static _______ reverse1(__________________________________) {}5. Use the code from page 89 or Booksite Ex.1.4.4 to write a function reverse2() toreverse the elements in a String array. The array is an argument of the method. Themethod does not return anything. It reverses the original array. (Web Exercise2.1.35)Recommended book exercises: 2.1.3, 2.1.4, 2.1.13,


View Full Document

Princeton COS 126 - Function Activity - 2.1

Download Function Activity - 2.1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Function Activity - 2.1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Function Activity - 2.1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?