第一章
1.1public class Test{
public static void main(String[]args){System.out.println("Welcome to Java!"); System.out.println("Welcome to Computer Science!");System.out.println("Progr amming is fun.");
}
}
java程序设计基础视频1.2public class Test{
public static void main(String[]args){for(int i=0;i<=4;i++){
System.out.println("Welcome to Java!");}
}
}
1.3public class Test{
public static void main(String[]args){System.out.println("]");System.out.printl n("]");System.out.println("]]");System.out.println("]]");
}
}
public class Test{public static void main(String[]args){System.out.println("A"); System.out.println("A A");System.out.println("AAAAA");System.out.println("A A");}
}
public class Test{public static void main(String[]args){System.out.println("V V
");System.out.println("V V");System.out.println("V V");System.out.println(" V");
}
}
1.4public class Test{
public static void main(String[]args){
System.out.println("a a^2a^3");
System.out.println("111");System.out.println("248");System.out.println("3 927");System.out.println("41664");
}
}
1.5public class Test{
public static void main(String[]args){System.out.println((9.5*4.5-2.5*3)/(45.5-3.5) );
}
}
1.6public class Test{
public static void main(String[]args){int i=1,sum=0;for(;i<=9;i++)sum+ =i;
System.out.println(sum);
}
1.7public class Test{
public static void main(String[]args){
System.out.println(4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11));
System.out.println(4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11+1.0/13));}
}
1.8public class Test{public static void main(String[]args){final double PI=3.14; double radius=5.5;
System.out.println(2*radius*PI);System.out.println(PI*radius*radius);}
}
1.9public class Test{
public static void main(String[]args){System.out.println(7.9*4.5);System.out.p rintln(2*(7.9+4.5));
}
}
1.10public class Test{
public static void main(String[]args){
double S=14/1.6;
double T=45*60+30;
double speed=S/T;System.out.println(speed);
}
1.11public class Test{public static void main(String[]args){int BN=312032486; //original person numbers double EveryYS,EveryYBP,EveryYDP,EveryYMP;EveryY S=365*24*60*60;EveryYBP=EveryYS/7;EveryYDP=EveryYS/13;Every YMP=EveryYS/45;
int FirstYP,SecondYP,ThirdYP,FourthYP,FivthYP;
FirstYP=(int)(BN+EveryYBP+EveryYMP-EveryYDP);SecondYP=(int)(FirstYP +EveryYBP+EveryYMP-EveryYDP);ThirdYP=(int)(SecondYP+EveryYBP+Ev eryYMP-EveryYDP);FourthYP=(int)(ThirdYP+EveryYBP+EveryYMP-EveryYD P);FivthYP=(int)(FourthYP+EveryYBP+EveryYMP-EveryYDP);System.out.pri ntln(FirstYP);System.out.println(SecondYP);System.out.println(ThirdYP);Syste m.out.println(FourthYP);
System.out.println(FivthYP);
}
}
1.12public class Test{public static void main(String[]args){double S=24*1.6; double T=(1*60+40)*60+35;double speed=S/T;System.out.println(sp eed);
}
}
1.13import java.util.Scanner;
public class Test{public static void main(String[]args){Scanner input=new Scan ner(System.in);
System.out.println("input a,b,c,d,e,f value please:");
double Double();
double Double();double Double();double d=input. nextDouble();
double Double();
第二章
package cn.Testcx;
import java.util.Scanner;
public class lesson2{
public static void main(String[]args){@SuppressWarnings("resource")Scanner in put=new Scanner(System.in);
System.out.print("请输入一个摄氏温度:");double Double();double Fahrenheit=(9.0/5)*Celsius+3 2;System.out.println("摄氏温度:"+Celsius+"度"+"转换成华氏温度为:
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论