CS 241 – Computer Programming II Lab Kalpa Gunaratna –

Slides:



Advertisements
Similar presentations
CISC Data Structures Ben Perry University of Delaware Summer 2011.
Advertisements

CS Fall 2012, Lab 01 Haohan Zhu. Boston University Slideshow Title Goes Here CS Fall 2012, Lab /17/2015 Using Piazza 
More methods and classes, 4 of 4 Math 130 Introduction to Programming Lecture # 18 Monday, October 8, 2007.
Announcements Homework #8 due Monday at 6:00pm Reference implementation coming soon! Upcoming office hours: Tomorrow: Chris 1:30-3pm, Swati 6:30-7:30pm.
Ain't It A Shame 1-4 Aint it a shame to work on Sunday, Aint it a shame, (a working shame,) Aint it a shame to work on Sunday, Aint it a shame, (a working.
CSE Spring 2015 INTERMEDIATE PROGRAMMING
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 5 Types Types are the leaven of computer programming;
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
Look Ahead Today – HW#4 out Monday – Regular class (not lab) Tuesday – HW#4 due at 4:45 Wednesday – Last class - return clickers Thursday – Regular office.
Constants. 2 Objectives Describe ways to create constants –const –readonly –enum.
Information Hiding and Encapsulation
Saturday May 02 PST 4 PM. Saturday May 02 PST 10:00 PM.
CSE 115 Week 4 February 4 - 8, Monday Announcements Software installation fest Tuesday & Wednesday 4-7 in Baldy 21. Software installation fest Tuesday.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
University of British Columbia CPSC 111, Intro to Computation 2009W2: Jan-Apr 2010 Tamara Munzner 1 More Class Design Lecture 13, Wed Feb
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
Time Zones The World is divided up into 24 time zones. Each time zone is approximately 15 degrees of longitude wide. The time within each time zone has.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
Intro to Java Programming  A computer follows the instruction precisely and exactly.  Anything has to be declared and defined before it can be used.
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
Java Implementation: Part 3S CompSci 230 Software Construction.
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
Classes CS 21a: Introduction to Computing I First Semester,
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
1 Operators and Expressions Instructor: Mainak Chaudhuri
CSc2310 tutoring session, week 8 Fall, 2012 Haidong Xue 5:30pm—8:30pm 11/06/2012 and 11/07/2012 -Test 3 Study Guide.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
ISBN Chapter 6 Data Types Introduction Primitive Data Types User-Defined Ordinal Types.
Types(1). Lecture 52 Type(1)  A type is a collection of values and operations on those values. Integer type  values..., -2, -1, 0, 1, 2,...  operations.
Functions Overview Functions are sequence of statements with its own local variables supports modularity, reduces code duplication Data transfer between.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
More Python!. Lists, Variables with more than one value Variables can point to more than one value at a time. The simplest way to do this is with a List.
Week 61 Introduction to Programming Ms. Knudtzon C Period Tuesday October 12.
INTEL ULTIMATE ENGINEERING EXPERIENCE. INTRODUCTIONS.
1 2/21/05CS250 Introduction to Computer Science II Destructors, Get and Set, and Default Memberwise Assignment.
Side effects A side effect is anything that happens in a method other than computing and/or returning a value. Example: public class hello { public int.
CS201 – Introduction to Computing – Sabancı University 1 Built-in Arrays l C++ native array type (not the class version) l Two versions ä fixed size arrays.
1 Project 3 String Methods. Project 3: String Methods Write a program to do the following string manipulations: Prompt the user to enter a phrase and.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
Expense Report Total Miles MONDAY 5 5 TUESDAY WEDNESDAY 6 6 THURSDAY FRIDAY SATURDAY 0 SUNDAY0 TOTAL 23.
Enum public enum Week {Sunday, Moday, Tuesday, Wednesday, Thursday, Friday, Saturday} Week.Sunday.ordinal()  0 Week.Sunday  “Sunday”
1 Enums (Chapter 4) To enumerate is: to name things one after another in a list Java has a type, called an enum, where a programmer specifies a finite.
AP Java Ch. 4 Review Question 1  Java methods can return only primitive types (int, double, boolean, etc).
Homework #3: Classes and Constructors By J. H. Wang Apr. 24, 2015.
The birthday calendar 2B : Unit 6 Days of the week Days of the week.
Pointers A pointer type variable holds the address of a data object or a function. A pointer can refer to an object of any one data type; it cannot refer.
Array contiguous memory locations that have the same name and type. Note: an array may contain primitive data BUT an array is a data structure a collection.
Computer Programming Lab 6. Exercise 1 Sample Runs.
1 Project 5: Leap Years. 222 Leap Years Write a program that reads an integer value from the user representing a year and determines if the year is a.
Happy Days by Charles Fox and Norman Gimbel PowerPoint by Camille Page.
ENUMERATED TYPES Java Basics. Enumerated Type Topics Why use them? Defining an enumerated type Using an enumerated type Advanced features.
Designing Classes Lab. The object that you brought to class Put it in the basket we will exchange them now.
Problem of the Day  Why are manhole covers round?
CS 241 – Computer Programming II Lab
CS 241 – Computer Programming II Lab
CS 240 – Computer Programming I Lab
More Sophisticated Behavior
CS 240 – Computer Programming I Lab
Software Development Java Classes and Methods
CSE 1020:Programming by Delegation
Recap Week 2 and 3.
2009 Test Key.
Presentation transcript:

CS 241 – Computer Programming II Lab Kalpa Gunaratna –

Contact  Contact by   Office hours  376 Joshi  Mondays & Wednesday 3:00 pm – 4:00 pm

UML class diagram tips….  Basic class structure.  Access modifiers  + public, - private, # protected Class name Variable declarations : Method declarations ( : ) :

Java class and equivalent UML Class  Example : Public Class MyClass { Private int x; Public String y; Private void setVal(int z) { x = z; } Public String getName() { return y; } MyClass - x : int + y : String + setVal(z : int) + getName() :String

Comments  // - single line comment  /* */ - multiple line comments  /** */ - javadoc comments  Example JavaDoc commnet /** Takes input value y and calculates fixed amount and returns the calculated value. Pre-condition: value should be an integer of the range 1 – 9 Post-condition: value is equal to the expected y input integer returns calculated value */ Public int calcValue(int y) { return 5; }

In lab  Draw UML class diagram and explain during the lab.  Put your method signature only into java class and should compile without any error.  All methods should have JavaDoc comment and inline comments or comment blocks.  UML and class should have all the methods listed in the assignment page.

Post lab  Implement your stubbed java class.  Must have javadocs and comments as in in lab.  Call your methods and test whether they are working as mentioned in javadocs.

enum  You can type enum with whatever name you want to use, lets say you need days of week to be represent in constants, enum Days{MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY};  When you want to access MONDAY, use Days.MONDAY  See example in assignment.  More information and how to use enum : tml tml