{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSC216fall05exam1v2key

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

Info icon This 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
Image of page 1

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

View Full Document Right 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( ) ; } public static void main (String [ ] args) { // provide statements to thoroughly
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern