⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 markfinding.java

📁 一些Java的小的应用程序
💻 JAVA
字号:


	import java.io.*;
	public class Markfinding {
	 
	 public static void main(String[] args) {
	  
	  PrintWriter output1=null;
	  try
	  {
	   output1=new PrintWriter(new FileOutputStream("shunxu.txt"));
	      }
	  catch(FileNotFoundException e)
	  {
	   System.out.println("Error opening the file shunxu.txt.");
	      System.exit(0);
	  }
	  char answer='y';
	  int hao; String line1=null;
	  while (answer!='n')
	  {
	  System.out.println(" 请输入学号.");
	  hao=SavitchIn.readLineInt();
	  output1.println(hao);
	  System.out.println("输入姓名,性别");
	  line1=SavitchIn.readLine();
	  output1.print("  "+line1);
	  int pingjun,n,sum=0,x=1;
	  while (x<=10)
	  {
	   System.out.println("输入十门功课成绩.");
	   n=SavitchIn.readLineInt();
	      output1.print("  "+n);
	      sum=sum+n;
	      x++;
	  }
	  pingjun=sum/10;
	  output1.println("  "+pingjun);
	  System.out.println(" continue(y/n)");
	  answer=SavitchIn.readLineNonwhiteChar();}
	  output1.close();
	  System.out.println("   输入完毕.");
	  BufferedReader input1=null;
	  try
	  {
	   input1=new BufferedReader(new FileReader("shunxu.txt"));
	  }
	  catch(FileNotFoundException e)
	  {
	   System.out.println("Error opening the file shunxu.txt.");
	      System.exit(0);
	  }
	//  boolean kongzhi=true;  
	  int n=1,xuehao; String line2,line3;
	  try
	  {
	   System.out.println("enter the xuehao.");
	      xuehao=SavitchIn.readLineInt();
	  if(xuehao<=0)
	  {
	   System.out.println("there is not the number.");
	      System.exit(0);
	  }
	  line2=input1.readLine();
	  line3=input1.readLine();
	  while ((line2!=null)&&(n<xuehao))
	  {
	   n++;
	      line2=input1.readLine();
	      line3=input1.readLine();
	  }
	  if(n==xuehao)
	   System.out.println(line2+line3);
	  else System.out.println("there is not the number.");
	  input1.close();
	 }
	  catch (IOException e)
	  {
	   System.out.println("Error reading from file shunxu.txt.");}
	      System.out.println("end of the programm.");
	  }
	 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -