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
Design a method to compute the tips for a bill: Two parameters: 1.Subtotal (double) 2.Service quality (String, “good”, “OK” or “Bad”) The method returns the tips number: For “good” service – 20% For “OK” service – 15% For “Bad” service – 10%
3
There is a file “phonenumber.txt” saved a list of phone numbers. Give a number (read from jTextField1). If this number exists in the number list print “Exist!” in jLabel1; else print “Not exist!”
4
int [ ] numbers = {8, 3, 2, 5}; int sum = 0; for (int index = 0; index < numbers.length; index++) { if (sum < 10) { if (sum < 10) { sum = sum + numbers[index]; sum = sum + numbers[index]; }}System.out.println(sum);
5
Design a class to describe a video (should have properties like video length; video format, e.g. wmv, mpeg, flash; resolution of video, e.g. 1024 X 768 or 640 X 480), while your class should have a constructor function with another two methods: getVideoFormat and getVideoLength.
6
Design a class to describe a video player. The properties including video player name; video player support OS (like windows or Mac); and the video playing right now (type: video class). With a constructor and a method: getVideoPlayerName.
7
Given two double type variables: number1 and number2 If number1 is larger than number2; swap the values of these variables.
8
Write the following numbers to a file “numbers.txt” 2,4,6,8,10,…,1000
9
int [] numbers = new int [50]; int [] numbers = new int [50]; for (int index = 0; index <= 50; index ++) { for (int index = 0; index <= 50; index ++) { numbers [index] = index * 2; numbers [index] = index * 2; } System.out.println(numbers[15]); System.out.println(numbers[15]); What is the result???
10
String names [] = new String [1000]; for (int index = 0; index < 1000; index ++) { for (int index = 0; index < 1000; index ++) { if (nameMatch(names[index], "Alice")) { if (nameMatch(names[index], "Alice")) { System.out.println(names[index]); System.out.println(names[index]); } } Write the code to implement nameMatch(String……, String……)
11
50 numbers saved in numbers[49] Print all the numbers larger than average
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.