1 / 38

COMPUTER 2430 Object Oriented Programming and Data Structures I

An introduction to object-oriented programming, focusing on building and testing classes, using inheritance and polymorphism, and exploring data structures such as stack, queue, and linked lists.

aroberts
Download Presentation

COMPUTER 2430 Object Oriented Programming and Data Structures I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMPUTER 2430Object Oriented Programming andData Structures I Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu 342-1418

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

  3. 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 500

  7. All programs MUST be completed to pass the course!

  8. Grading Grade Total PointsPercentage Grade Points A 460 - 500 92% 4.0 A - 445 - 459 89% 3.7 B + 435 - 444 87% 3.3 B 410 - 434 82% 3.0 B - 395 - 409 79% 2.7 C + 385 - 394 77% 2.3 C 360 - 384 72% 2.0 C - 345 - 359 69% 1.7 D + 335 - 344 67% 1.3 D 300 - 334 60% 1.0 F Below 300 Below 60% 0.0 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

  12. COMP 1430 and COMP 2430 • Software Development Grand Rules • Must follow the rules • You may lose many points on style

  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 https://alpha.ion.uwplatt.edu/grader/ • 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++ 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++ 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 Java // Array is a class int[] intArray; float floatArray[]; // To get an array object // Magic word: new intArray = new int[50]; C++ int intArray[50]; // Array of valCount 50 0 1 3 4 48 49 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

More Related