1 / 37

COMP 121

COMP 121. Week 01. Agenda. Introductions Review policies, procedures, and expected outcomes Learning Activities Introduce homework problems. Introductions. Policies, Procedures and Expected Outcomes. Administrivia. Course Outcomes

nau
Download Presentation

COMP 121

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. COMP 121 Week 01

  2. Agenda • Introductions • Review policies, procedures, and expected outcomes • Learning Activities • Introduce homework problems

  3. Introductions

  4. Policies, Procedures and Expected Outcomes

  5. Administrivia Course Outcomes • Apply the advanced object-oriented principles of inheritance and polymorphism to analyze real-world problems and design, implement, and test solutions. • Detect and correct runtime program errors using exceptions. • Read and write random access and sequential files of text and binary data.

  6. Administrivia Course Outcomes (continued) • Analyze space and time complexity of algorithms. • Design, implement, test, debug, and document linear data structures. • Use lists, stacks, and queues to solve problems. • Recognize and apply the design patterns of Strategy, Template Method, Iterator, and Adapter in object-oriented designs. • Discuss relationships between the disparate topic areas addressed in this course.

  7. Administrivia Texts Big Java 3rd Edition, Cay Horstmann, ISBN: 978-0-470-10554-2 (2nd Edition is acceptable) Head First Design Patterns, Eric Freeman and Elisabeth Freeman, ISBN: 0-596-00712-4 Objects, Abstraction, Data Structures, and Design Using Java, Elliot Koffman and Paul Wolfgang, ISBN: 0-471-46756-1

  8. Administrivia Points breakdown

  9. Weekly Activities • Check course announcements and bulletin board postings • Read the associated sections from the text books and key points • Complete the weekly learning activities in class • Read and consider the weekly homework problems • Complete the homework assignment • Work on any scheduled lab assignments • Note significant learning for reflection paper

  10. Course is carefully designed such that each activity lays the foundation for the next Skipping activities is considered harmful I will assume the lower layers when discussing the higher layers Exam Lab Homework Discussion Learning activities Readings Weekly Activities

  11. Major Themes • Object-oriented design • Design patterns • Test-driven development • Linear data structures

  12. This Week’s Outcomes • Review the fundamental object-oriented principles of encapsulation, composition, and abstraction. • Review the algorithmic building blocks of methods, selection, and repetition. • Review the properties, operations, and use of primitive data types, strings, and arrays. • Use an integrated development environment to edit, compile, run, submit, and correct a Java program.

  13. Guided Learning Activity Solutions for Week 01

  14. Learning Activities Activity 1-1 • Outcome: Review the fundamental object-oriented principles of encapsulation, composition, and abstraction.

  15. Learning Activities Q: Consider the following problem description, and decide what classes you should use to implement it. For each class, also list its methods and instance fields. A user places coins in a vending machine and selects a product by pushing a button. If the inserted coins are sufficient to cover the purchase price of the product, the product is dispensed and change is given. Otherwise, the inserted coins are returned to the user. The user also has an option to cancel the sale and have his or her coins returned.

  16. Learning Activities

  17. Learning Activities Q: Employees receive their paychecks biweekly. Hourly workers are paid their hourly rates for each hour worked; however, anyone who works more than 40 hours per week is paid overtime at 150% of the regular wage. Salaried employees simply get the two-week portion of their yearly salary regardless of how many hours they work.

  18. Learning Activities

  19. Learning Activities Q: Customers order products from a store. Invoices are generated to list the items, payments received, and amount still due. Products are shipped to the shipping address of the customer, and invoices are sent to the billing address.

  20. Learning Activities

  21. Learning Activities Activity 1-2 Outcome: Review the algorithmic building blocks of methods, selection, and repetition. Q: Describe the selection control structures available within Java.

  22. Learning Activities A: if (condition) { … } else { … } switch (selector) { case label: statements; break; case label: statements; break; default: statements; } Q: Describe the repetition control structures available within Java.

  23. Learning Activities A: while (condition) { … } do { … } while (condition); for (initialization; condition; update) { … } Q: In the following expression, what happens if num is 0? (num != 0 && num / num)

  24. Learning Activities A: It looks like an ArithmeticException should be thrown because of division by zero, but because of short-circuiting, the second half of the expression is never evaluated. Q: What is the purpose of a break statement? What is the purpose of a continue statement?

  25. Learning Activities A: The purpose of a break statement is to end execution of a loop immediately. The purpose of a continue statement is to end execution of the current iteration, and begin the next iteration immediately.

  26. Learning Activities Activity 1-3 Outcome: Review the properties, operations, and use of primitive data types, strings, and arrays. Q: List and describe the primitive types in Java.

  27. Learning Activities A: Q: In Java, how do declare a variable to be constant?

  28. Learning Activities A: With the keyword final. Q: What does each of the following operators do?

  29. Learning Activities

  30. Learning Activities Q: Given the following three statements: String greeting = “hello”; String welcome = greeting; String salutations = “hello”; What are the truth-values of (greeting == welcome) and (greeting == salutations)?

  31. Learning Activities A: As it turns out, they’re both true because of the specific details of how the String class works. However, you should not use == to compare the value of objects. Q: If you had a long String that contained an entire paragraph of text, how would you go about breaking it up into individual words?

  32. Learning Activities A: String [] words = text.split(“ “);

  33. Learning Activities Q: Write tests for the flight control system, and repair the parts that have been sabotaged.

  34. Homework Problems

  35. BlueJDebugger Demo

  36. Homework 01 • No homework this week! • Install and review the software • Java Development Kit (JDK) • JDK Documentation • BlueJ IDE • Activity Files

  37. Question and Answer Session

More Related