把test.java救回来了
This commit is contained in:
+24
-24
@@ -1,25 +1,25 @@
|
||||
//Main.java
|
||||
package task1;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Scanner;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
SimpleDateFormat in = new SimpleDateFormat("yyyy M dd");
|
||||
Date d = new Date();
|
||||
try {
|
||||
d = in.parse(input.nextLine());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SimpleDateFormat out = new SimpleDateFormat("yyyy MMMM dd EEEE", Locale.ENGLISH);
|
||||
String formattedDate = out.format(d);
|
||||
System.out.println("今天是" + out.format(d).toUpperCase());
|
||||
|
||||
}
|
||||
//Main.java
|
||||
package task1;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Scanner;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
SimpleDateFormat in = new SimpleDateFormat("yyyy M dd");
|
||||
Date d = new Date();
|
||||
try {
|
||||
d = in.parse(input.nextLine());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SimpleDateFormat out = new SimpleDateFormat("yyyy MMMM dd EEEE", Locale.ENGLISH);
|
||||
String formattedDate = out.format(d);
|
||||
System.out.println("今天是" + out.format(d).toUpperCase());
|
||||
|
||||
}
|
||||
}
|
||||
+27
-27
@@ -1,27 +1,27 @@
|
||||
//Main.java
|
||||
package task2;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
Date inDate = new Date();
|
||||
SimpleDateFormat inFormat = new SimpleDateFormat("yyyy年M月d日", Locale.CHINA);
|
||||
System.out.print("请输入您家孩子的出生日期(格式为yyyy年M月d日):");
|
||||
try {
|
||||
inDate = inFormat.parse(input.nextLine());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long inTimeStamp = inDate.getTime();
|
||||
long outTimeStamp = inTimeStamp + (long) 100 * 24 * 60 * 60 * 1000;
|
||||
Date outDate = new Date(outTimeStamp);
|
||||
SimpleDateFormat outFormat = new SimpleDateFormat("yyyy年M月dd日 EEEE", Locale.CHINA);
|
||||
System.out.println("经计算,您家孩子的百日宴应该设在" + outFormat.format(outDate));
|
||||
}
|
||||
}
|
||||
//Main.java
|
||||
package task2;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
Date inDate = new Date();
|
||||
SimpleDateFormat inFormat = new SimpleDateFormat("yyyy年M月d日", Locale.CHINA);
|
||||
System.out.print("请输入您家孩子的出生日期(格式为yyyy年M月d日):");
|
||||
try {
|
||||
inDate = inFormat.parse(input.nextLine());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long inTimeStamp = inDate.getTime();
|
||||
long outTimeStamp = inTimeStamp + (long) 100 * 24 * 60 * 60 * 1000;
|
||||
Date outDate = new Date(outTimeStamp);
|
||||
SimpleDateFormat outFormat = new SimpleDateFormat("yyyy年M月dd日 EEEE", Locale.CHINA);
|
||||
System.out.println("经计算,您家孩子的百日宴应该设在" + outFormat.format(outDate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
package task3;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class StringLearning {
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
String stringExample = scanner.next();
|
||||
String endStr = " end";
|
||||
// ---------------------Begin------------------------
|
||||
System.out.println(stringExample);// 1.输出原字符串
|
||||
System.out.println(stringExample.length());// 2.求出字符串长度
|
||||
// 3.字符串转换成相应的大/小写
|
||||
System.out.println(stringExample.toUpperCase());
|
||||
System.out.println(stringExample.toLowerCase());
|
||||
// 4.截取指定位置的字符串(3-7)
|
||||
System.out.println(stringExample.substring(3, 7));
|
||||
// 5.字符串相加具体输出要求请看测试说明。
|
||||
System.out.println(stringExample + endStr);
|
||||
// ---------------------End------------------------
|
||||
}
|
||||
}
|
||||
package task3;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class StringLearning {
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
String stringExample = scanner.next();
|
||||
String endStr = " end";
|
||||
// ---------------------Begin------------------------
|
||||
System.out.println(stringExample);// 1.输出原字符串
|
||||
System.out.println(stringExample.length());// 2.求出字符串长度
|
||||
// 3.字符串转换成相应的大/小写
|
||||
System.out.println(stringExample.toUpperCase());
|
||||
System.out.println(stringExample.toLowerCase());
|
||||
// 4.截取指定位置的字符串(3-7)
|
||||
System.out.println(stringExample.substring(3, 7));
|
||||
// 5.字符串相加具体输出要求请看测试说明。
|
||||
System.out.println(stringExample + endStr);
|
||||
// ---------------------End------------------------
|
||||
}
|
||||
}
|
||||
|
||||
+15
-15
@@ -1,15 +1,15 @@
|
||||
//Main.java
|
||||
package task4;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
double value1 = 2, value2 = 0;
|
||||
System.out.println("绝对值:\t" + Math.abs(value1));
|
||||
System.out.println("3次幂:\t" + Math.pow(value1, 3));
|
||||
System.out.println("二次方根:\t" + Math.pow(value1, 0.5));
|
||||
System.out.println("sin值:\t" + Math.sin(value1));
|
||||
System.out.println("较大者:\t" + Math.max(value1, value2));
|
||||
}
|
||||
}
|
||||
//Main.java
|
||||
package task4;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
double value1 = 2, value2 = 0;
|
||||
System.out.println("绝对值:\t" + Math.abs(value1));
|
||||
System.out.println("3次幂:\t" + Math.pow(value1, 3));
|
||||
System.out.println("二次方根:\t" + Math.pow(value1, 0.5));
|
||||
System.out.println("sin值:\t" + Math.sin(value1));
|
||||
System.out.println("较大者:\t" + Math.max(value1, value2));
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -1,18 +1,18 @@
|
||||
package task5;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Roster {
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
/********** Begin *********/
|
||||
String roster1 = "张三,李四,王五";
|
||||
String roster2 = scanner.nextLine();
|
||||
if (roster1.equals(roster2)) {
|
||||
System.out.println("相同");
|
||||
} else {
|
||||
System.out.println("不同");
|
||||
}
|
||||
/********** End *********/
|
||||
}
|
||||
}
|
||||
package task5;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Roster {
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
/********** Begin *********/
|
||||
String roster1 = "张三,李四,王五";
|
||||
String roster2 = scanner.nextLine();
|
||||
if (roster1.equals(roster2)) {
|
||||
System.out.println("相同");
|
||||
} else {
|
||||
System.out.println("不同");
|
||||
}
|
||||
/********** End *********/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user