嘿,这只是课堂上的一个简单的练习,我决定去做一个例外.根据书的输入,这个问题应该采用以下格式:2009年4月19日我想要的是什么做我的例外是确保用户(无论谁评级)遵循这些参数,以便我的程序工作.这看起来不错吗?我可以做得更好吗?
编辑:感谢您的及时答复!我知道我有很多东西需要学习,但希望有一天我能够回答这里的问题.干杯
import jpb.*;
public class ConvertDate {
public static void main(String[] args) {
try{
SimpleIO.prompt("Enter date to be converted: ");
String bam = SimpleIO.readLine();
bam = bam.trim().toLowerCase();
//empty space is taken off both ends and the entirety is put in lower case
int index1 = bam.indexOf(" ");
int index2 = bam.lastIndexOf(" ");
int index3 = bam.indexOf(",");
/*critical points in the original string are located using indexing to divide and conquer
in the next step*/
String month = bam.substring(0,index1);
String …Run Code Online (Sandbox Code Playgroud)