Write the following method that returns a new string in which the uppercase are changed to lowercace and lowercace to uppercase.
EX: enter: aBcD ,output: AbCd。
2015年1月29日 星期四
2015年1月19日 星期一
java程式設計題目---數字處理【座標最短距離與座標】
設計一程式,提示使用者輸入座標點數,再依序輸入所有點的二為座標(x,y)。
(a)找出點之間的最短座標。
(b)找出是那些點之間的最短距離。
例如:
輸入: 輸出:
輸入座標點數:3 最短距離:2.00
依序輸入3個座標x、y: 那些點之間距離最短:
0 3 (1,0);(3,0)
1 0
3 0
(a)找出點之間的最短座標。
(b)找出是那些點之間的最短距離。
例如:
輸入: 輸出:
輸入座標點數:3 最短距離:2.00
依序輸入3個座標x、y: 那些點之間距離最短:
0 3 (1,0);(3,0)
1 0
3 0
java程式設計題目---數字處理【十六進位轉二進位】
設計一程式,提示使用者輸入一16進位數字,將該16進位數字轉為對應的2進位數字。使用字元"1"或"0"每四個空一格的方式從螢幕輸出。
例如:輸入123F5,輸出:0001 0011 1111 0101。
例如:輸入123F5,輸出:0001 0011 1111 0101。
2014年12月27日 星期六
java程式設計題目---數字處理【雙生質數(使用method)】
Twin primes(雙生質數) are a pair of prime numbers that differ by 2. For example, 3 and 5 are twin primes, 5 and 7 are twin primes, and 11 and 13 are twin primes. Write a program to find all twin primes less than 1,000. Display the output as follows:
(3,5)
(5,7)
...
(3,5)
(5,7)
...
java程式設計題目---公式計算【梅森質數(使用method)】
A prime number is called a Mersenne prime(梅森質數) if it can be written in the form 2^p-1 for some positive integer p.
Write a program that finds all Mersenne prime with p<=31 and displays the output as follows:
p 2^p-1
2 3
3 7
5 31
...
Write a program that finds all Mersenne prime with p<=31 and displays the output as follows:
p 2^p-1
2 3
3 7
5 31
...
2014年12月26日 星期五
java程式設計題目---數字處理【迴文質數判斷(使用method)】
A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a palindromic prime, as are 313 and 757. Write a program that displays the first 100 palindromic prime numbers. Display 10 numbers line, separated by exactly one space, as follows:
2 3 5 7 11 101 131 151 181 191
313 353 373 383 727 757 787 797 919 929
2 3 5 7 11 101 131 151 181 191
313 353 373 383 727 757 787 797 919 929
java程式設計題目---數字處理【迴文判斷(使用method)】
Write the methods with the following headers:
public static int reverse(int number)
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.
public static int reverse(int number)
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.
java程式設計題目---數字處理【數值反轉(使用method)】
Write a method with the following header to display an interger in reverse order:
public static int reverse(int number)
For example, reverse(3456) displays 6543. Write a test program that promotes the user to enter an integer and displays its reversal.
public static int reverse(int number)
For example, reverse(3456) displays 6543. Write a test program that promotes the user to enter an integer and displays its reversal.
java程式設計題目---字母處理【輸出字母、換行(使用method)】
Write a method that prints characters using the following header:
public static void printChars(char ch1, char ch2, int numberPerLine)
This method prints the characters between ch1 and ch2 with the specified numbers per line. Write a test program the prints ten characters per line from 1 to Z. Character are separated by exactly one space.
public static void printChars(char ch1, char ch2, int numberPerLine)
This method prints the characters between ch1 and ch2 with the specified numbers per line. Write a test program the prints ten characters per line from 1 to Z. Character are separated by exactly one space.
java程式設計題目---圖形繪製【使用2的n次方印三角形(使用method)】
Write a method to display a pattern as follows:
1
1 2
1 2 4
1 2 4 8
...
1 2 4 8 ....
The method header is
public static void displayPattern(int n)
1
1 2
1 2 4
1 2 4 8
...
1 2 4 8 ....
The method header is
public static void displayPattern(int n)
java程式設計題目---數字處理【由大到小排序(使用method)】
Write a method with the following header to display three numbers in decreasing order:
public static void displaySortedNumbers(double num1, double num2, double num 3)
Write a test program that prompts the user to enter three numbers and invokes the method to display them in decreasing order.
public static void displaySortedNumbers(double num1, double num2, double num 3)
Write a test program that prompts the user to enter three numbers and invokes the method to display them in decreasing order.
java程式設計題目---公式計算【判斷一年有幾天(使用method)】
Write a method that returns the number of days in a year using the following header:
public static int numberOfDaysInAYear(int year)
Write a test program that displays the number of days in year from 2000 to 2020.
public static int numberOfDaysInAYear(int year)
Write a test program that displays the number of days in year from 2000 to 2020.
java程式設計題目---數字處理【數字拆解(使用method)】
Write a method that computes the sum of the digits in an integer. Use the following method header:
public static int sumDigits(long n)
For example, sumDigits(234) returns 9 (2+3+4). Use a loop to repeatedly extract and remove the digit until all the digits are extracted. Write a test program thar prompts the user to enter an inter an integer and displays the sum of all its digits.
public static int sumDigits(long n)
For example, sumDigits(234) returns 9 (2+3+4). Use a loop to repeatedly extract and remove the digit until all the digits are extracted. Write a test program thar prompts the user to enter an inter an integer and displays the sum of all its digits.
2014年12月24日 星期三
java程式設計題目---數字處理【拆解後輸出(轉成String型態)】
設計一程式,提示使用者輸入一整數介於1~32767之間。將此整數拆解後於螢幕輸出。
例如:輸入4567,輸出4 5 6 7 。
java程式設計題目---圖形印製【三角形(2的m次方)】
設計一程式,提示使用者輸入正整數n,在螢幕上書出n層下列圖形。
例如:輸入5,輸出:
1
1 2 1
1 2 4 2 1
1 2 4 8 4 2 1
1 2 4 8 16 8 4 2 1
1 2 4 8 16 32 16 8 4 2 1
例如:輸入5,輸出:
1
1 2 1
1 2 4 2 1
1 2 4 8 4 2 1
1 2 4 8 16 8 4 2 1
1 2 4 8 16 32 16 8 4 2 1
java程式設計題目---數字處理【排列組合】
設計一程式,提示使用者輸入兩個整數m、n,接下來從螢幕輸出最小可能(m,n)到最大可能(m,n)的組合。
例如:輸入2,4,輸出:(2,3),(3,4)
例如:輸入2,4,輸出:(2,3),(3,4)
java程式設計題目---數字處理【十進位轉二進位】
設計一程式,提示使用者輸入正整數n,將該數值轉換成二進位數制,並以16-bit方式於螢幕輸出結果。
例如:輸入18,輸出 0000 0000 0001 0010。
例如:輸入18,輸出 0000 0000 0001 0010。
訂閱:
文章 (Atom)
Go(Golang)程式語言 設定GCC
下載MSYS2: https://www.msys2.org/ 安裝 程式開始執行後輸入: pacman -Syu y y 在安裝目錄底下找到msys2.exe,雙擊執行 輸入指令: pacman -Su pacman -S --needed base-devel mingw-...
-
MNIST手寫數字辨識資料集 MNIST手寫數字辨識資料集 ,是由 Yann LeCun(揚·勒丘恩) 大神所蒐集,這位大神同時也是Convulution Nueral Networks(卷積神經網絡)的創始人,因此享有"卷積網絡之父"的美譽。關於這位大...
-
第一章 二、效能與效率有何區別 ? 效能 : 作對的事情 效率 : 把事情做對 五、管理程序包括哪四項管理職能 ? 規劃、組織、領導、控制 六、管理者所扮演的色有哪些 ? 人際角色 : 頭臉人物、領導者、聯絡人 資訊角色 : 監控者、傳播者、發言人...
-
顯示語言 在一班情況下, Vsiual Studio Code (VSCode) 安裝完成後為英語版本,當然它也附有其他九種語言,分別是:英文(美國)、簡體中文、繁體中文、法文、德文、義大利文、日文、韓文、俄文、西班牙文。各個語言與其代碼對照如下表: Display ...