?? mod1ans.lst
字號:
listing 1
/*
Compute your weight on the moon.
Call this file Moon.java.
*/
class Moon {
public static void main(String args[]) {
double earthweight; // weight on earth
double moonweight; // weight on moon
earthweight = 165;
moonweight = earthweight * 0.17;
System.out.println(earthweight + " earth-pounds is equivalent to " +
moonweight + " moon-pounds.");
}
}
listing 2
/*
This program displays a conversion
table of inches to meters.
Call this program InchToMeterTable.java.
*/
class InchToMeterTable {
public static void main(String args[]) {
double inches, meters;
int counter;
counter = 0;
for(inches = 1; inches <= 144; inches++) {
meters = inches / 39.37; // convert to meters
System.out.println(inches + " inches is " +
meters + " meters.");
counter++;
// every 12th line, print a blank line
if(counter == 12) {
System.out.println();
counter = 0; // reset the line counter
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -