Download presentation
Presentation is loading. Please wait.
1
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu https://xliu12.mysite.syr.edu
2
Read the following code: double number; String result; If (number >= 5) { result = “good” } else { result = “bad” } number = 5.0; System.out.println(result);
3
Read the following code: double salary, taxrate, income; salary = 1893.20 if (salary >= 3000) { taxrate = 0.30; } else { if (salary >= 2000) { taxrate = 0.20; } else { taxrate = 0.10; } income = salary * (1 - taxrate); System.out.println(income);
4
Read the following code: double hours, rate, salary; String position = “manager”; hours = 40; If (position.equals(“manager”) || hours > 40) { rate = 80; } else { If (position.equals(“employee”) || hours > 40) { rate = 60; } else { rate = 40; } salary = hours * rate
5
Read the following code: int result, step; step = 1; result = 20; While (result > 10) { result = result – step; if (step%2 == 0) { step = step - 1; } else { step = step + 1; } System.out.println(result);
6
Read the following code: int total = 0; for (int index = 1; index < 17; index++) { total = total + 3; } System.out.println(total);
7
Read the following code: Design a method Parameters: an array of integers - num[]; an integer – rate. The method should return a new array with each element enlarged [rate] times.
8
Read the following code: Suppose Syracuse University wants to expand student number 1.5% every year. Input the “current student number” and “years”; predict the number of students in the future (years number later).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.