InClassAssignment020409[1] - CIS106:JavaProgramming...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 106:  Java Programming CIS 106:  Ch 7 (Methods) 02/04/09 1.  Define the terms:  parameter, argument, method signature 2. Write method headers for the following methods: a. Computing a sales commission, given the sales amount and the commission rate  b. Testing whether a number is even, and returning  tru e if it is not 3. Identify and correct errors in the following program: public class Test { Public static void main(String[]args) { Int num = 89; Int mum = 2; method1(num,mum); } public static void method1(int n, int m) { n+=m; xMethod(3.4); System.out.println(n); } User-Defined Methods Page 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CIS 106:  Java Programming public static int xMethod(int n) {   if (n > 0)          return 1; else if (n ==0)  return 0; else if (n < 0)  return – 1; }} 4.  How is an argument passed to a method?  Can the argument have the same name as  its parameter? 5.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

InClassAssignment020409[1] - CIS106:JavaProgramming...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online