This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 2003-1 Midterm CMPT 1011. Write a complete Java program calledAvthat reads a sequence of integer values from theuser (keyboard), and then prints one value to the screen. If the first value entered by theuser isn, then the program should readnmore valuesfrom teh input, and then compute andprint the avereage of thesenvalues. (Include all your code in teh main method. You do notneed to prompt the user)2. Write a Java MethodgetInput, which takes three parameters, oneStringand two of typeint. If the method invocationgetInput(s,i,j) is executed, the method prints the stringstothe screen, then gets an int value from the user. If this value is in the range ofitoj, thevalue is returned. Otherwise, the use ris told to enter a value in this range and another valueis read. This repeats until a value within the range is entered and returned.3. In recent assignments, we have used arrays to store lists of values. For this question, assumewe are using an arraryaof typeItem to store a list of items, with teh first list item in...
View Full Document
This note was uploaded on 01/16/2010 for the course CMPT 101 taught by Professor Various during the Spring '03 term at Simon Fraser.
- Spring '03