11.11

练习一
<电子时间>
在这里插入图片描述

public class day11_01 {
public static void main(String[]args){
for(int shi=0;shi<24;shi++){
for(int fen=0;fen<60;fen++){
for(int miao=0;miao<60;miao++){
System.out.println(shi+"."+fen+"."+miao);
}
}
}
}

练习二
<玩具定价和染色>
在这里插入图片描述

public class day11_02 {
String color;
double money;
public void goumai(){
System.out.println(“正在购买…”);
}

public class day11_03 {
public static void main(String[]args){
day11_02 a=new day11_02();
System.out.println(“当前价格:”+a.money);
System.out.println(“正在定价中…”);
a.money=20.0;
System.out.println(“定价后:”+a.money);
System.out.println("——————————————————————");
System.out.println(“当前颜色:”+a.color);
System.out.println(“正在染色中…”);
a.color=“粉色”;
System.out.println(“染色后:”+a.color);
a.goumai();
}

练习三
<自我介绍>
在这里插入图片描述

public class day11_04 {
String name;
int age;
String gender;
int score;
public void saiHi(){
System.out.println(“打招呼”);
System.out.println(“大家好,我的名字叫”+name+",我今年"+age+“岁了,”+“我是”+gender+“的,”+“我”+score+“分”);
}

public class day11_05 {
public static void main(String[]args){
day11_04 a=new day11_04();
a.name=“张三”;
a.age=17;
a.gender=“男”;
a.score=78;
a.saiHi();
}
}

import java.util.Scanner;
public class day11_07 {
public static void main(String[]args){
Scanner a=new Scanner(System.in);
for(;😉{
int sz=a.nextInt();
for(int j=1;j<=sz;j++){
for(int kong=1;kong<=sz-j;kong++){
System.out.print(" “);
}
for(int hua=1;hua<=j;hua++){
System.out.print(hua);
System.out.print(” ");
}
System.out.println();
}
}
}

练习五
<数字金字塔,菱形>

import java.util.Scanner;
public class day11_06 {
public static void main(String[]args){
Scanner a=new Scanner(System.in);
for(;😉{
int sz=a.nextInt();
for(int j=1;j<=sz;j++){
for(int kong=1;kong<=sz-j;kong++){
System.out.print(" “);
}
for(int hua=1;hua<=j;hua++){
System.out.print(hua);
System.out.print(” “);
}
System.out.println();
}
for(int j=1;j<=sz;j++){
for(int kong=1;kong<=j;kong++){
System.out.print(” “);
}
for(int hua=1;hua<=(sz-1-j)+1;hua++){
System.out.print(hua);
System.out.print(” ");
}
System.out.println();
}
}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值