1 / 18

CSE 1020: Introduction to Computer Science I

This course aims to develop programming skills in Java, focusing on writing multiclass applications. It covers topics such as UML, OOP, and API, and includes examples of calculating rectangle area and volume. The course also covers algebraic laws and explains compile-time errors.

brosen
Download Presentation

CSE 1020: Introduction to Computer Science 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. CSE 1020: Introduction to Computer Science I Mark Shtern

  2. Course Objective • Developing development skills • Writing Java Multiclass application • Introducing the software engineering concern • Study UML, OOP, API

  3. Example 01 Write application that calculates rectangle area

  4. Example 02 Write application that calculates volume of rectangle couboid

  5. Math & Computers • Algebraic laws • (a*b) /c is equal to a * (b/c) • (a + b) – c is equal to a + (b -c)

  6. Ex 1.16 • What is program output? char grade= ‘B’; System.out.print(grade); { System.out.print(grade); { grade = ‘C’; System.out.print(grade); } } System.out.println(grade);

  7. Ex 1.17 Explain the compile-time error long speed = 1; int size = 7; { boolean even = false; long speed = 5; size = 2; } int even = 3; System.out.println(speed); System.out.println(size); System.out.println(even);

  8. Ex 1.17 What is output? long speed = 1; int size = 7; { boolean even = false; size = 2; } int even = 3; System.out.println(speed); System.out.println(size); System.out.println(even);

  9. Summary • Types • Declaration • Arithmetic Operations +,-,/,* ,% (remainder) • Casting • Scope

  10. Shortcuts a++  a=a+1 a--  a=a-1 a+=6  a=a+6 a*=6 a=a*6

  11. Literal • Real • 7D or 7d  7 is double • 2.5E 3  2.5*10^3 or 2500.0 • Boolean • true or false • Character • ‘\t’ , ‘\n’, \’, ‘\\’,’\”’

  12. Program Execution Edit Compile Run

  13. Java Program Byte code javac Compile-time Errors VM CPU Byte code java instruction

  14. Ex 1.18 Is it true that expression a * b * c/d (1) is evaluated as ((a * b) * (c /d)) (2)

  15. Ex 1.21 int i = 6; long l = 4; double d = 12; l = i + i; d = i + i; i = l + l; l = d + d; Explain the compile-time error

  16. Ex 1.22 int x = 3; int y = 14; double pie = x + y / 100.0; int z = (5 % 4) + 6 / 8; System.out.println (pie); System.out.println(z); Explain the compile-time error or predict its output

  17. Math & Computer sqrt(x^2) vs (sqrt(x))^2 (1/x) * x vs x * 1/x

  18. Char Type • What is output? char letter = ‘D’; letter = (char) (letter +1); System.out.println(letter); ------------------------------------------ char letter = ‘D’; char letter2 = ‘A’; System.out.println(letter2 - letter);

More Related