Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS102--Object Oriented Programming Discussion 1: – Project 4 on Page 328 – The use of arrays Copyright © 2008 Xiaoyan Li.

Similar presentations


Presentation on theme: "CS102--Object Oriented Programming Discussion 1: – Project 4 on Page 328 – The use of arrays Copyright © 2008 Xiaoyan Li."— Presentation transcript:

1 CS102--Object Oriented Programming Discussion 1: – Project 4 on Page 328 – The use of arrays Copyright © 2008 Xiaoyan Li

2 Project 4 on Page 328 Classes Instance variables Methods

3 Project 6 on Page 409 Write a program that reads numbers from the keyboard into an array of type int[]. You may assume that there will be 50 or fewer entries in the array. Your program allows any number of numbers to be entered, up to 50 numbers. The output is to be a two-column list. The first column is a list of the distinct array elements; the second column is the count of the number of occurrences of each element. The list should be sorted on entreis in the first column, largest to smallest. Example array input : -12 3 -12 4 1 1 -12 1 -1 1 2 3 4 2 3 -12 The output should be: N count 4232 14 -11 -124

4 Exercise1: A student takes 5 courses this semester. write a program that read her scores from the keyboard, output her scores from the highest to the lowest and her average score.

5 Exercise2: There are 5 registered students in our class. Each takes 4 courses this semester. Write a program that read scores from the keyboard, calculate the average score for each student and output the average scores from the highest to the lowest.

6 Announcement Next Lecture: Inheritance Reading assignment: Chapter 7


Download ppt "CS102--Object Oriented Programming Discussion 1: – Project 4 on Page 328 – The use of arrays Copyright © 2008 Xiaoyan Li."

Similar presentations


Ads by Google