1.用java计算已知一个小时60分钟一分钟60秒计算一个小时有多少秒的源码源代码?
2.java编程基础,输入1-7显示对应星期,源码云存储小说源码求大神的源码上饶溯源码燕窝源码和解体思路
3.JAVA编写源代码,要求使用数组存储一年12个月份的天数,并按顺序输入
用java计算已知一个小时60分钟一分钟60秒计算一个小时有多少秒的源代码?
public class Test7 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("输入小时数:");
Integer number = scanner.nextInt();
System.out.println(number+"个小时有秒:"+**number+"秒");
}
}
java编程基础,输入1-7显示对应星期,源码如何读stl源码求大神的源码底部看盘源码源码和解体思路
import java.util.Scanner;
public class Temp {
public String getWeek(int i) {
switch(i) {
case 1: return "Monday";
case 2: return "Tuesday";
case 3: return "Wednesday;";
case 4: return "Thursday";
case 5: return "Friday";
case 6: return "Saturday";
case 7: return "Sunday";
default: return "Unknown week";
}
}
public static void main(String[] args) {
Temp t = new Temp();
Scanner scanner = new Scanner(System.in);//输入1-7
System.out.println(t.getWeek(scanner.nextInt()));//显示对应星期
}
}
JAVA编写源代码,要求使用数组存储一年个月份的天数,并按顺序输入
代码如下:import java.util.Scanner;public class App {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int[] months = new int[];
for (int i = 0; i < months.length; i++) {
months[i] = scanner.nextInt();
}
for (int i = 0; i < months.length; i++) {
System.out.println((i + 1) + "月有" + months[i] + "天");
}
}
}
运行结果: