第六次作业

 

package zzz;

public class Zjy {
public static void main(String[] args) {
// TODO 自动生成的方法存根

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 zzz;

import java.util.Scanner;

public class Zjy {
public static void main(String[] args) {
// TODO 自动生成的方法存根

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 zzz;

import java.util.Scanner;

public class Zjy {
public static void main(String[] args) {
// TODO 自动生成的方法存根

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;

}

}

}
 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值