Download presentation
Presentation is loading. Please wait.
1
程式設計實作
2
實作 實作一 實作二 (Palindrome integer) Write the following two methods
// Return the reversal of an integer, i.e. reverse(456) returns 654 public static int reverse(int number) // Return true if number is palindrome public static boolean isPalindrome(int number) Use the reverse method to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome. 實作二 (Using the Random class) Write a program that creates a Random object with seed1000 and displays the first 50 random integers between 0 and 100 using the nextInt(100) method.
3
實作 實作三 (Binary to hex) Write a method that parses a binary number into a hex number. The method header is as follows: public static String binaryToHex(String binaryValue) Write a test program that prompts the user to enter a binary number and displays the corresponding hexadecimal value. 實作四 (Displaying labels) Write a program that displays four lines of text in four labels, as shown in Figure 12.15(a). Add a line border on each label. PPT 下載 :
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.