LectureObjects2InClass

LectureObjects2InClass - Good morning, and welcome to CS...

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

View Full Document Right Arrow Icon
Good morning, and welcome to CS 5MA Three levels of understanding: How to design a program using multiple objects How to use a class that someone else designed and implemented How to implement a class Take the grades class and split it up between two classes - take the verbs and make them methods in another class - group the methods into sets that operate on the same data - put the data into the class A few tasks in the program: 1) read input 2) convert grade to a point value 3) add up the total points 4) calculate the GPA These two variables are used again and again, so they are candidates for our new class. instance data for our new class totalPoints totalUnits instance methods for our new class add up the total points (merge with convert grade to a point value) I named it "enterGrade" calculate the GPA I named it "getGPA" Do all of: convert grade, add total points, calculate GPA I named it "enterGradegetGPA" One convention for designing classes is to never put Input and Output in your helper classes - only in main
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course CMPSC 5 taught by Professor Franklin during the Fall '09 term at UCSB.

Page1 / 3

LectureObjects2InClass - Good morning, and welcome to CS...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online