P63页第2.3题
package cn.edu.www;
import java.util.Scanner;
public class YingChiJiSuan {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter a value for feet:");
double d = input.nextDouble();
double valueForFeet = d * 100;
System.out.println("valueforfeet is " + valueForFeet + "In ValueForFeet");
}
}
P64页2.4题
package cn.edu.www;
import java.util.Scanner;
public class BangKeShu {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter a number of pound:");
double a = input.nextDouble();
double NumberOfPound= 0.454*a;
System.out.println("NumberOfPound is" + NumberOfPound +"inNumberOfPound");
}
}
P64页2.5题
package cn.edu.www;
import java.util.Scanner;
public class XiaoFei {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter a number of expenditure");
double expenditure = input.nextDouble();
double tip = expenditure * 0.15;
System.out.println("tip" + tip + "tip");
double amount = expenditure + tip;
System.out.println("amount is " + amount + "in amount");
}
}
第64页2.6题
package cn.edu.www;
import java.util.Scanner;
public class NumBer {
//此题完成了一半;
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int y = 932;
int z = 14;
int x1 = y %10;
System.out.println("Enter a number 0 and 1000 e.g. :");
double a = input.nextDouble();
double Number = a-y;
System.out.println("x1 is" + x1 + "in x1");
System.out.println("number is" + Number +"in number" );
}
}
第64页第2.7题
package cn.edu.www;
import java.util.Scanner;
public class TiMe {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the number of minutes e.g.10,0000,0000:");
double NumberOfMintues = input.nextDouble();
double year = 365;
double day = 24;
double Second = 60;
//365*24*60=525600;
double a = year * day * Second;
//1000000000/525600;
double b = NumberOfMintues / a;
/*10亿取模/365*24*60
* 24*60
*/
double year2 = NumberOfMintues%(365*24*60)/(24*60);
System.out.println("the b is " + b +"and day is" + year2);