This is the first graded lab for CS2102. You will be graded by your ability to make progress on the primary task.
If you are in the Lab, perform the routine KH 202 setup or AK 120D setup; for now, ignore the "advanced setup" options. If you would like to set up Eclipse on your personal computer, then (a) install Java JDK 1.5 if you need to as described in tools section (here); and (b) install Eclipse as described in tools section (here).
Design a program where the user enters a number n (which must be > 3) that determines the number of integers in a set that will be entered, one per line. Because the user is entering in a set, you can be assured that all numbers will be distinct. Your program must then read in n numbers from the keyboard and print out the average of the n-2 numbers that remain when you ignore the highest and the lowest numbers from the set.
Enter the size of the set? 7 Now enter the 7 numbers, one per line 8 2 9 13 90 15 7 The average of these numbers after removing the high value (90) and the low value (2) is 10.4 |
Review the design recipe we have been following. Design questions to be answered in Lab and handed in
Note: do not go out of your way to describe every possible form of input. If you only considered one form, then state that. Don't invent spurious alternatives that were never really taken seriously.
Create a class Lab1 in the package defined by your CCC unix name.
Given a scanner constructed from System.in, you can read the next integer simply by invoking the nextInt() method call. Refer to the class examples, and the book (Section 2.2, pp. 78)
Your goal is to turnin the assignment file (Lab1.java) by November 1st at 11:59 PM. The name of the assignment you should use is "lab1".
Date | Reason/Change |
10/16/06 | Initial Page |