内容发布更新时间 : 2024/12/25 13:00:31星期一 下面是文章的全部内容请认真阅读。
.
3、package start;
import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException;
public class Xiugai { public static void main(String args[]) throws IOException {
FileReader bout=new
FileReader(\); BufferedReader fout1 =new BufferedReader(bout); String value; int i=0;
String a[] = new String[6];
while((value=fout1.readLine())!=null) {
Word 资料
.
}
a[i]=value; i++;
System.out.println(\原来的成绩\); for(int j=0; j<5; j++) { }
System.out.println(a[j]);
a[2]=String.valueOf(((Integer.parseInt(a[0])+Integer.parseInt(a[1])+Integer.parseInt(a[2])+Integer.parseInt(a[3])+Integer.parseInt(a[4]))/5));
bout.close();
FileOutputStream testfile = new
FileOutputStream(\);
testfile.close();
testfile.write(new String(\).getBytes()); FileWriter fout=new
FileWriter(\,true);
for(int i1=0; i1<5; i1++) { }
System.out.println(\修改后的成绩\); for(int j=0; j<5; j++) {
fout.write(a[i1]+\);
Word 资料
.
}
}
System.out.println(a[j]);
fout.close();
4、
}
package TEST4; import java.util.Scanner; public class test4 {
public static void main(String[] args){
System.out.println(\请输入一个小于99999的整数:\); Scanner s=new Scanner(System.in); int a=s.nextInt();
if(a>99999)System.out.println(\); if(a>9999) {
System.out.println(\位\);int []x=new int[5];
x[0]=a;x[1]=(a/10);x[2]=a/100;x[3]=a/1000;x[4]=a/10000; for(int i=0;i<=4;i++) { }
System.out.print(x[i]);
Word 资料
.
}
if(a>999&a<10000) { System.out.println(\位\);int []x=new int[4]; x[0]=a;x[1]=(a/10);x[2]=a/100;x[3]=a/1000; for(int i=0;i<=3;i++) { System.out.print(x[i]);
}
}
if(a>99&a<1000) { System.out.println(\位\);int []x=new int[3]; x[0]=a;x[1]=(a/10);x[2]=a/100; for(int i=0;i<=2;i++) { System.out.print(x[i]);
}
}
if(a>9&a<100){ System.out.println(\位\);int []x=new int[2]; x[0]=a;x[1]=a/10; for(int i=0;i<=1;i++) { System.out.print(x[i]);
}
}
if(a>0&a<10){
System.out.println(\位\); System.out.print(a); }
}
}
Word 资料