CS 117 Spring 2002 April 5, 2002. Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday.

Slides:



Advertisements
Similar presentations
Core Java Lecture 4-5. What We Will Cover Today What Are Methods Scope and Life Time of Variables Command Line Arguments Use of static keyword in Java.
Advertisements

CSCI 160 Midterm Review Rasanjalee DM.
A file reminder Files are used to store data and information They are manipulated through a pointer to FILE (FILE *) This pointer is returned when opening.
Chapter 5 C Functions The best way to develop and maintain a large program is to divide it into several smaller program modules, each of which is more.
CS 206 Introduction to Computer Science II 01 / 21 / 2009 Instructor: Michael Eckmann.
CS 117 Spring 2002 More Classes. IEEE Student Conference Student Professional Awareness Conference –Paul Kostek: career options for 21st Century –Panel.
Programming Assignment #3 CS-2301, B-Term Programming Assignment #3 User-defined Functions Due, November 18, 11:59 PM (Assignment adapted from C:
 2000 Prentice Hall, Inc. All rights reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program Modules in C 5.3Math Library Functions 5.4Functions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
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)
CS 117 Spring 2002 Classes Hanly: Chapter 6 Freidman-Koffman: Chapter 10, intro in Chapter 3.7.
Arrays Hanly - Chapter 7 Friedman-Koffman - Chapter 9.
Review for midterm exam Dilshad M. Shahid Spring NYU.
Random (1) Random class contains a method to generate random numbers of integer and double type Note: before using Random class, you should add following.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 12 – Craps Game Application: Introducing Random.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
CS 225 Java Review. Java Applications A java application consists of one or more classes –Each class is in a separate file –Use the main class to start.
CS 117 Spring 2002 Class and Function Reuse derived classes templates.
1 Random numbers Random  completely unpredictable. No way to determine in advance what value will be chosen from a set of equally probable elements. Impossible.
Monday, 11/18/02, Slide #1 CS 106 Intro to CS 1 Monday, 11/18/02  QUESTIONS??  Today:  Hand back, discuss HW #4  Discussion of Lab 10  Exam #2 Friday.
C Lecture Notes Functions (Cont...). C Lecture Notes 5.8Calling Functions: Call by Value and Call by Reference Used when invoking functions Call by value.
CS 206 Introduction to Computer Science II 01 / 23 / 2009 Instructor: Michael Eckmann.
1 Data Structures Topic #1 Welcome !. 2 Today’s Agenda Introduction...what to expect!?! Talk about our Goals and Objectives Textbook is highly recommended.
CS 117 Spring 2002 Review for Exam 3 arrays strings files classes.
1 BUILDING JAVA PROGRAMS CHAPTER 3 THE SCANNER CLASS AND USER INPUT.
Craps!. Example: A Game of Chance Craps simulator Rules – Roll two dice 7 or 11 on first throw, player wins 2, 3, or 12 on first throw, player loses 4,
1 Review of Java Higher Level Language Concepts –Names and Reserved Words –Expressions and Precedence of Operators –Flow of Control – Selection –Flow of.
C# B 1 CSC 298 Writing a C# application. C# B 2 A first C# application // Display Hello, world on the screen public class HelloWorld { public static void.
CNG 140 C Programming (Lecture set 9) Spring Chapter 9 Character Strings.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Chapter 8. About the Midterm Exam.. Exam on March 12 Monday (Tentatively) Review on March 7 Wednesday Cover from Chapter 6 Grades will be out before spring.
Week 7 - Wednesday.  What did we talk about last time?  scanf()  Memory allocation  malloc()  free()
Stacks. A stack is a data structure that holds a sequence of elements and stores and retrieves items in a last-in first- out manner (LIFO). This means.
DATA STRUCTURES LAB 1 TA: Nouf Al-harbi
CMSC 1041 Functions II Functions that return a value.
 2008 Pearson Education, Inc. All rights reserved Case Study: Random Number Generation C++ Standard Library function rand – Introduces the element.
More About Objects and Methods Chapter 5. Outline Programming with Methods Static Methods and Static Variables Designing Methods Overloading Constructors.
Object Oriented Programming (OOP) Lecture No. 11.
Loops Wrap Up 10/21/13. Topics *Sentinel Loops *Nested Loops *Random Numbers.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Functions (Header files and Library Functions) Outline.
CS221 Random Numbers. Random numbers are often very important in programming Suppose you are writing a program to play the game of roulette The numbers.
 Structures are like arrays except that they allow many variables of different types grouped together under the same name. For example you can create.
EPSII 59:006 Spring Call-by-value example #include void increment(int); //prototype for increment function int main(void) { int a=1; printf("Value.
KIC/Computer Programming & Problem Solving 1.  Header Files  Storage Classes  Scope Rules  Recursion Outline KIC/Computer Programming & Problem Solving.
More C++ Bryce Boe 2013/10/23 CS24, Fall Outline Project 1 Review Alignment and Padding Finish C++ Introduction.
Random numbers in C++ Nobody knows what’s next....
1D Arrays and Random Numbers Artem A. Lenskiy, PhD May 26, 2014.
A First Book of ANSI C Fourth Edition Chapter 6 Modularity Using Functions: Part I.
Function Call Stack and Activation Frame Stack Just like a pile of dishes Support Two operations push() pop() LIFO (Last-In, First-Out) data structure.
Homework #3: Classes and Constructors By J. H. Wang Apr. 24, 2015.
MR. CRONE Generating Random Numbers. Random Numbers Many programs require the computer to generate random numbers Random numbers are used in many applications.
Today Javadoc. Packages and static import. Viewing API source code. Upcoming Topics: –protected access modifier –Using the debugger in Eclipse –JUnit testing.
Midterm 2 Review Notes on the CS 5 midterm Take-home exam due by 5:00 pm Sunday evening (11/14) Hand in your solutions under the door of my office, Olin.
Functions Course conducted by: Md.Raihan ul Masood
Functions.
Functions, Part 2 of 2 Topics Functions That Return a Value
Number guessing game Pick a random number between 1 and 10
CSC113: Computer Programming (Theory = 03, Lab = 01)
Deitel- C:How to Program (5ed)
Chapter 5 - Functions Outline 5.1 Introduction
Chapter 5 - Functions Outline 5.1 Introduction
CS Week 14 Jim Williams, PhD.
Chapter 5 - Functions Outline 5.1 Introduction
توابع در C++ قسمت اول اصول كامپيوتر 1.
Chapter 6 - Functions Outline 5.1 Introduction
A First Book of ANSI C Fourth Edition
CS150 Introduction to Computer Science 1
Review Lab assignments Homework #3
Functions in C Math Library Functions Functions Function Definitions
Presentation transcript:

CS 117 Spring 2002 April 5, 2002

Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday

Random numbers use the rand function from stdlib.h –int rand() returns an integer from 0 to RAND_MAX (a big number) –the sequence you get is always the same use % to get numbers from 1 to 6 dieValue = 1 + rand() % 6;

randomizing dice #include at the top of your main function srand( time( NULL)); See testFns for an example

yahtzee NOW DUE: April 12 you may write a single player game (since my Player class doesn't seem to be getting written) input and output format are up to you this time –please explain the input required of the user in your readme

static members functions and variables belong to the class as a whole rather than a specific instance use them with className:: in front of the name (object reference will also work)

Common Programming Errors Not defining a function as a member of a class Referencing a private attribute of a class Missing header files Missing ; on class definition

Common Programming Errors Mismatch in signature between header and function definitions Prefixing a class function call –obj.function(); –don't use class name except for static functions trying to access instance variables from a static function