Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTER 2430 Object Oriented Programming and Data Structures I

Similar presentations


Presentation on theme: "COMPUTER 2430 Object Oriented Programming and Data Structures I"— Presentation transcript:

1 COMPUTER 2430 Object Oriented Programming and Data Structures I
Instructor: Qi Yang 213 Ullrich Day1 on Thursday, before lab1

2 Web Sites My Home Page http://people.uwplatt.edu/~yangq/ Click Here
COMPUTER 2430 Home Page

3 Nadine Gadjou Lab 206 3:00 – 5:00 PM Monday - Thursday
Lab Assistant Nadine Gadjou Lab 206 3:00 – 5:00 PM Monday - Thursday

4 Course Description An introduction to object-oriented programming.
Emphasis on building and testing classes using software engineering techniques. Includes study of a standard class library and use of inheritance and polymorphism for building subclasses and extensibility. Coverage of the stack and queue classical data structures. Discussion of searching, sorting, and hashing techniques. Introduction to linked lists.

5 Expected Learning Outcomes
Develop software using elementary data structures. Design, implement, and test programs using classes, inheritance, and polymorphism. Compare and contrast algorithm efficiency at a very basic level. Write module tests, system tests, and develop test specifications. Perform simple object-oriented analysis and design. Work in a small team (two or three people) on the analysis, design, implementation, and testing of a project.

6 Course Work 6 Quizzes 60 3 Tests 150 Programs and Labs 190 Final 100
Total

7 All programs MUST be completed to pass the course!

8 Grading Grade Total Points Percentage Grade Points A 460 - 500 92% 4.0
B % B % B % C % C % C % D % D % F Below Below 60% NO CURVE!

9 Prereq: COMPUTER 1430 Congratulations! C- or Better on COMPUTER 1430
AP tested out of COMPUTER 1430 Welcome to CSSE! COMPUTER 2430 is MUCH more difficult! One reason: Summer is too long! A C/C- in Computer 1430 may not be good enough! AP tested out: good enough?

10 Fall 2017 73 students at the beginning 6 students dropped by week 2
67 students left 4 students withdrew by week 8 63 students left 15 failed (D or F) 48 students passed (C- or above) Passing rates 66% (48/73), 72% (48/67), or 76% (48/63)

11 COMP 1430 and COMP 2430 COMPUTER 1430 C++ Procedural programming
Visual Studio COMPUTER 2430 Java Object Oriented Programming (OOP) NetBeans Data Structures Could do OOP with C++

12 COMP 1430 and COMP 2430 Software Development Grand Rules
Must follow the rules You may lose many points on style Could do OOP with C++

13 NetBeans Installed in all labs in Ullrich Install NetBeans on Your PC
K:\Academic\CSSE\Software\NetBeans_8.1_JDK_8u91 Follow Instructions Step by Step Import format settings Do not auto update

14 Lab1 Five Points Due Friday at 10 pm September 7 Lab Assistant in 206
1:00 – 3:00 The First Week

15 Creating Java Project in NetBeans
Open NetBeans Menu File/New Project (or New Project on Toolbar) Categories: Java Projects: Java Application Next Project Name: Lab1 Project Location: K:\, J:\ or USB drive Uncheck “Create Main Class” Finish

16 Completing Lab1 Download file IntegersList.java to folder src of your Lab1 project folder Open IntegersList.java in NetBeans Source Packages <default packages> Complete IntegersList.java according to the 23 DOs

17 Running Java Programs in NetBeans
NetBeans compiles automatically after saving Right click IntegersList.java Select “Run File” Shift+F6 Output Window Run: Enter input values in the Output Window BUILD SUCCESSFUL (total time: ?? seconds)

18 Submitting Lab1 to the Grader
Go to the Grader page at Login using your UWP username and password Choose CS 2430! Choose Lab1 Upload your IntegersList.java Submit Must receive 0 differences!

19 Limit on the Grader You will lose points if you submit Lab1 to the grader too many times: -1 if more than 10 times -2 if more than 15 times Compile and run your Lab1 Checking output before submitting

20 The K:\ Drive K:\Course\CSSE\yangq\2430 Individual folders
Should create the Labs/Progs inside your folder on the K:\ drive For Demo and Q&A Must use the K:\ drive

21 C++ and Java At the statements level for our class, Java is almost the same as C++. Review your C++ Labs and Programs!

22 Primitive Data Types char ASCII and Unicode int, short, long
float, double bool (C++) and boolean (Java) byte

23 C++ and Java // Declaration statement
int value, total = 0, remainder, quotient; value = 5; // assignment if (value > 0) total += value; else { remainder = value % 5; quotient = value / 5; } // Statement terminator: semicolon

24 Output C++ Java cout << “The value: ” << value;
cout << “The value: ” << value << endl; Java System.out.print(“The value: ” + value); System.out.println(“The value: ” + value);

25 Input C++ Java int intValue;
cout << “Enter an integer: ” << endl; cin >> intValue; Java import java.util.Scanner; Scanner sc = new Scanner(System.in); int intValue; System.out.println(“Enter an integer: ”); intValue = sc.nextInt();

26 C++ and Java /** While loops are the same.
We could use it for comment in C++. */ int count = 0, total = 0; while (count < 100) // magic number { ++ count; // same as count ++ in // most cases total += count; // total = total + count; }

27 C++ and Java /** For Loops are also the same
We decided to use “/**” for comment start */ for (int i = 0; i < count; i ++) { // Count-Controlled loop // Processing array elements }

28 Arrays C++ Java . . . . The same in Java and C++ Index from 0 to 49
int intArray[50]; // Array of valCount 50 Java // Array is a class int[] intArray; float floatArray[]; // To get an array object // Magic word: new intArray = new int[50]; 10 15 20 50 30 18 Index from 0 to 49 The same in Java and C++

29 Arrays COMPUTER 1430 Adding elements Deleting elements Linear Search
Computing max, min and avg Sorting

30 Linear Search /** intArray has valCount values and target is an int
Return the index of 1st element which equals target. Otherwise return -1. */ for (int i = 0; i < valCount; i++) { if (intArray[i] == target) return i; else // return -1? } // When to return -1? return -1;

31 Linear Search /** intArray has valCount values target is an int
Return the index of 1st element which equals target. Otherwise return -1. */ for (int i = 0; i < valCount; i++) { if (intArray[i] == target) return i; } return -1;

32 Correct? /** intArray has valCount values target is an int
Return the index of 1st element which equals target. Otherwise return -1. */ for (int i = 0; i < valCount; i++) { if (intArray[i] == target) if (i == target) // Correct? return i; } return -1;

33 Correct? final int MAX_SIZE = 50; int intArray[] = new int[MAX_SIZE];
int valCount = 0; /** intArray has valCount values and target is an int. Return the index of 1st element which equals target. Otherwise return -1. */ for (int i = 0; i < valCount; i++) for (int i = 0; i < MAX_SIZE; i++) // Correct? { if (intArray[i] == target) return i; } return -1;

34 Java Class public class IntegerList { private final int MAX_SIZE = 50;
private int intArray[] = new int[MAX_SIZE]; private int valCount = 0; public int find( int target ) for (int i = 0; i < valCount; i++) if (intArray[i] == target) return i; return -1; } . . .

35 Java Main Method public class IntegerList {
private final int MAX_SIZE = 50; private int intArray[] = new int[MAX_SIZE]; private int valCount = 0; public int find( int target ) . . . // other methods /** Selecting “Run File” in NetBeans after right clicking IntegersList.java will run the main method. */ public static void main(String [] args) // Testing the class return; }

36 Calling Class Methods public class IntegersList { public boolean addValue ( int intValue ) public int find ( int intValue ) public void print() public static void main( String [] args ) IntegersList list = new IntegersList(); list.addValue(inputValue); list.find(target); list.print(); }

37 Using Scanner to Input import java.util.Scanner; public class IntegersList { public static void main( String [] args ) IntegersList list = new IntegersList(); Scanner sc = new Scanner(System.in); System.out.println("Enter a value to add: "); inputValue = sc.nextInt(); list.addValue(inputValue); }

38 Lab1 Five Points Due Friday at 10 pm September 7 Start Early
Get zero differences Follow style rules


Download ppt "COMPUTER 2430 Object Oriented Programming and Data Structures I"

Similar presentations


Ads by Google