accp6.0JAVA1第五章上机练习(Accp6.0JAVA1 fifth chapter on the machine practice)
accp6.0JAVA1第五章上机练习(Accp6.0JAVA1 fifth chapter on the machine practice)
Public class Text1 {
/ * *
* @ param args
* /
Public static void main (string [] args) {
/ / all self generated method stub
Int a = 1;
Int sum = 0;
While (< = 100) {
Sum = sum +;
A + +;
If (a = = 101) {
System.out.println ("结果是:" + sum);
}
}
}
}
Public class text2 {
/ * *
* @ param args
* /
Public static void main (string [] args) {
/ / all self generated method stub
Int a = 0;
Int sum = 0;
While (< = 1000) {
If (a% 3 = = 0) {
Sum = sum +;
}
A + +;
}
System.out.println ("结果为:" + sum);
}
}
Import java.util.scanner;
Public class Text4 {
/ * *
* @ param args
* /
Public static void main (string [] args) {
/ / all self generated method stub
Int max = 0, min = 100000;
The scanner input = new scanner (system.in);
Int i = 0;
{
System.out.print ("请输入一个数字 (输入0结束):");
I = input.nextint ();
If (I = = 0)
Break;
If (I > Max {
Max = I;
}
If (I < min) {
Min = I;
}
} while (true);
System.out.println ("最大值是:" + + ", 最小值是 Max:" + min);
}
}
Import java.util. *;
Public class text9 {
/ * *
* @ param args
* /
Public static void main (string [] args) {
/ / all self generated method stub
The scanner input = new scanner (system.in);
String a;
Int bianhao;
Int Shuliang;
Int anount = 0;
Double txue = 245;
Double wangqiuxie = 570;
Double wangqiupai = 320;
Double discount = 0.8;
Double total = 0.0;
The double payment = 0.0;
Double Zhaoqian = 0.0;
System.out.println ("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
System.out.println ("请选择购买的商品编号:");
System.out.println ("1.t恤 \ t2.网球鞋 \ t3.网球拍");
System.out.println ("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
{
System.out.print ("请输入商品编号:");
Bianhao = input.nextint ();
System.out.println ("请输入购买数量");
Shuliang = input.nextint ();
The switch (bianhao) {
Case 1:
System.out.println ("t恤" + + "txue \ t数量" + + "Shuliang \ t合计"
+ txue * Shuliang);
Break;
Case 2:
System.out.println ("网球鞋" + + "wangqiuxie