CSC216fall05exam1v2key

CSC216fall05exam1v2key - 1 CSC216 Fall 05 (2nd versiononly...

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

View Full Document Right Arrow Icon
CSC216 Fall 05 (2 nd version…only those sections that are different from version 1 are provided) Exam 1 Student Name ____________________________________________________ This exam is closed book and closed notes. There are 105 points (5 points extra credit). You are not required to provide documentation for the code you write. Good luck! Part 1 Java Basics (35 points) (25 points) 1. Complete/fill in the Student class below (and continued on next page) . Each Student has a name, an array with room for up to 10 integer lab quiz scores, as well as the current number of scores as private instance variables. Do not document the code you write but do use good style and programming conventions . public class Student { //put instance variable here. ______ String (String theName){ scores = new int [ 10 ]; count = 0; name = theName; } /** *add the score to the array if there is room. If there is no room, ignore the score * and return * @param score assumes integer value greater than or equal to zero */ public void addScore (int score ) { } 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
/** Returns the minimum quiz grade currently stored for the student * * * @return minimum score (zero is returned if no scores currently stored) */ public int getMinimum ( ) { 5 pts 1 pt if (count == 0 ) return 0; 3 pts int min = score[0]; for (int i = 1; i < count; i++) { if ( score[i] < min) min = score[i]; } 1 pt return min; } /** * Returns a String with the name and minimum quiz grade * @return String with name and minimum */ public String toString ( ) { return name + “ “ + getMinimum( ) ;
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.

This note was uploaded on 10/13/2008 for the course CSC 216 taught by Professor Miller during the Spring '08 term at N.C. State.

Page1 / 7

CSC216fall05exam1v2key - 1 CSC216 Fall 05 (2nd versiononly...

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