第六次作业

package xiaofu;

public class Shuzhu {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  int b[][] = new int[][]{{1},{1,1},{1,2,1},{1,3,3,1},{1,4,6,4,1},{1,5,10,10,5,1},{1,6,15,20,15,6,1},{1,7,21,35,35,21,7,1},{1,8,28,56,70,56,28,8,1},{1,9,36,84,126,126,84,36,9,1}};

  for(int x=0;x<b.length;x++) {
  for(int y=0;y<b[x].length;y++) {
  System.out.print(b[x][y]);

  }

  System.out.println();

  }

  }
 }

package xiaofu;
import java.util.Scanner;
public class Chengji {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner sc = new Scanner(System.in);

  System.out.println("请输入本班学生总数:");

  int studentcout = sc.nextInt();

  int achivement[][] = new int[studentcout][4];

  for (int i = 0; i < studentcout; i++) {
  System.out.println("请输入第" + (i + 1) + "个学生的编号:");

  achivement[i][0] = sc.nextInt();

  System.out.println("请输入语文成绩:");

  achivement[i][1] = sc.nextInt();

  System.out.println("请输入数学成绩:");

  achivement[i][2] = sc.nextInt();

  System.out.println("请输入英语成绩:");

  achivement[i][3] = sc.nextInt(); } System.out.println("学生成绩结果如下");

  System.out.println("---------------------------------------------");

  System.out.println("学生编号\t语文成绩\t数学成绩\t英语成绩\t平均成绩\t总成绩");

  for (int i = 0;i < achivement.length; i++) {
  double sum = 0;

  double ave = 0;

  for (int j = 0; j < achivement[i].length; j++) {
  System.out.print(achivement[i][j] + "\t");

  if (j > 0) {
  sum += achivement[i][j];

  }

  }

  ave = sum / 3;

  System.out.print(String.format("%.2f", ave) + "\t" + (int) sum + "\n"); }

  }

  }
 

package xiaofu;
import java.util.Scanner;
public class Chengji {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner sc = new Scanner(System.in);

  System.out.println("请输入本班学生总数:");

  int studentcout = sc.nextInt();

  int achivement[][] = new int[studentcout][4];

  for (int i = 0; i < studentcout; i++) {
  System.out.println("请输入第" + (i + 1) + "个学生的编号:");

  achivement[i][0] = sc.nextInt();

  System.out.println("请输入语文成绩:");

  achivement[i][1] = sc.nextInt();

  System.out.println("请输入数学成绩:");

  achivement[i][2] = sc.nextInt();

  System.out.println("请输入英语成绩:");

  achivement[i][3] = sc.nextInt(); } System.out.println("学生成绩结果如下");

  System.out.println("---------------------------------------------");

  System.out.println("学生编号\t语文成绩\t数学成绩\t英语成绩\t平均成绩\t总成绩");

  for (int i = 0;i < achivement.length;

package xiaofu;
import java.util.Scanner;
public class Chengx {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  int zuo[][] = new int[9][4];

  for (int i = 0; i < 9; i++) {
  for (int j = 0; j < 4; j++) {
  zuo[i][j] = 1;

  }

  }

  while (true) {
  System.out.println(" 简单客车售票系统" + "\n 9排4列的大巴车开始售票");

  for (int i = 0; i < 9; i++) {
  for (int j = 0; j < 4; j++) {
  System.out.print(zuo[i][j] + "\t");

  } System.out.println();

  }

  Scanner sc = new Scanner(System.in);

  System.out.print("请输入要预定的坐位行号:");

  int row = sc.nextInt();

  System.out.print("请输入要预定的坐位列号:");

  int column = sc.nextInt();

  zuo[row - 1][column - 1] = 0;

  }

  }

 
 }

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Mr.寒风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值