顯示具有 java-homework 標籤的文章。 顯示所有文章
顯示具有 java-homework 標籤的文章。 顯示所有文章

2008年6月14日 星期六

Lab Magic Parking Tower

A parking tower is out of order someday. If you park a Benz, you will end up with a Torben. Write a program to simulate this scenario. First create a class called CarParked which has a static method called outOfOrder. Name an object called yourCar, which happens to be a Benz. Your program should contain a class called CarParked and a test program called CarParkedDemo which test the method by CarParked.outOfOrder(yourCar).



2008年5月26日 星期一

Homework 5-19-2008

1. Do Temperature Project, which is Project 7 (3rd, 2nd ed.) or Project 3 (1st ed.).
Write a Temperature class that has two instance variables: a temperature value(a floating-point number) and a character for the scale, either C for Celsius or F for Fahrenheit. The class should have four constructor methods: one for each instance variable(assume zero degrees if no value is specified and Celsius if no scale is specified), one with two parameter for the two instance variable, and a no-argument constructor (set to zero degrees Celsius). Include the following:




2008年5月19日 星期一

Class Definition 3

Do Display 4.7 (3rd, 2nd ed.) or 4.5 (1st ed.).



Then use Display 4.8 to call 4.7.



In Display 4.7, if the method setDate has the parameter as setDate(int month, int day, int year), what kind of changes should be made in its body of codes?

2008年4月12日 星期六

Average income by gender

Write a program to calculate average income by gender based on the following data, where F stands for female and M for male.
You should be able to allow users to type in a whole line such as F 80,000 followed by next line M 30,100.



F 62,000
M 25,000
F 38,000
F 43,000
M 65,000
M 120,000
F 80,000
M 30,100



Without any change made to your program, your program should be able to process a new set of data, such as follows:

M 52,000
M 35,000
F 48,000
M 33,000
F 75,000
F 110,000
F 90,000
M 30,100

2008年3月23日 星期日

Homework 3-17-2008

※Project 1 of Chap. 2.
The Babylonian algorithm to compute the square root of a number n is as follows:
1.Make a guess at the answer(you can pick n/2 as your initial guess)
2.Compute r=n/guess
3.Set guess=(guess+r)/2
4.Go back to step 2 for as many iterations asnecessary.The more you repeat step 2
and 3,the closer guess will become to the square root of n.



※Project 3 of Chap. 2.
Write a program that reads in two integers typed on the keyboard and outputs their
sum,difference,and product it.

2008年3月16日 星期日

Homework 3-10-2008: String Processing

Write a program that starts with a line of text and then outputs that line of text with the first occurrence of "hate" changed to "love". For example, a possible sample output might be
The line of text to be changed is:
I hate you.
I have rephrased that line to read:
I love you.



Hint: You may consider use the methods: indexOf(A_String) and substring(Start, End) in your program.

2008年3月1日 星期六

Homework 2-25-2008

1. Watch The Inside Story (Video), write your words on the development and inventor of Java

2. List at least 5 applications of Java. You must provide the references you used. We recommend Google Search engine.

手機上的Java Games,健保卡,加拿大的停車費繳費系統,eBay,網路銀行、旅遊網站、簡訊發送、衛星導航、物流倉儲等等
1.Bluetooth Bicycle Computer
2.V-Girl
3.Slooh


Java 憑籍多用途、高效率、平台可攜性及安全性,成為網路運算的理想技術,成為當今 25 億台以上的裝置背後的動力來源:
7 億多台電腦 ,7 億 8 百萬支行動電話及其他手持裝置 (來源:Ovum) ,10 億張智慧卡 ,加上視訊轉換盒、印表機、網路攝影機、遊戲、汽車導航系統、樂透終端設備、醫療裝置、停車收費器等。
現在,您可以在各種網路與裝置中發現 Java 技術,從網際網路與科學用超級電腦,到膝上型電腦與行動電話,從華爾街市場模擬器到家用遊戲機與信用卡 -- 幾乎無處不在。

參考資料:Java Everywherejava