fork download
  1. // from https://i...content-available-to-author-only...e.com/TaR29j
  2. /* package whatever; // don't place package name! */
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.Date;
  7. import java.text.SimpleDateFormat;
  8. import java.text.*;
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. class TimeSheet
  12. {
  13. public static void main (String[] args) throws java.lang.Exception
  14. {
  15. //Scanner myObj = new Scanner(System.in); // Create a Scanner object
  16.  
  17. Scanner myObj = new Scanner(System.in); // use myObj so you don't have to change it if you choose to use hard-wired inputs
  18.  
  19. // https://w...content-available-to-author-only...t.com/how-to-format-date-using-printf-method-in-java
  20. Date dateObj = new Date();
  21.  
  22. // https://stackoverflow.com/posts/39066917/revisions
  23. SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM d, yyyy");
  24.  
  25. System.out.println("From \"https://c...content-available-to-author-only...e.com/pwm/action/mobileGetTimesheetPunches\"");
  26.  
  27. //stackoverflow/questions/2296685/how-to-read-input-with-multiple-lines-in-java
  28. //stackoverflow/questions/56887493/how-to-take-multi-line-input-in-java search:HashmatWarrior
  29. while(myObj.hasNext())
  30. {
  31. String gottaFix = myObj.nextLine();
  32. String[] dateString = new String[2];
  33. String header = "Type Status Time Hours";
  34. String hours;
  35. String[] punch = new String[4];
  36.  
  37. if(!gottaFix.isEmpty())
  38. {
  39. if(gottaFix.contains("Punches:"))
  40. {
  41. dateString = gottaFix.split(": ");
  42. dateObj = sdf.parse(dateString[1]);
  43.  
  44. System.out.printf("%ta", dateObj); // Sun
  45. System.out.printf(" %tm", dateObj); // date
  46. System.out.printf("/%te", dateObj); // date
  47.  
  48. System.out.print(", scheduledTime");
  49.  
  50. /*System.out.printf("Date: %td%n", dateObj); System.out.printf("Month: %tm%n", dateObj); System.out.printf("Year: %ty%n", dateObj); System.out.printf("getTime(): "+dateObj);*/
  51. }
  52.  
  53. else if(gottaFix.contains("M"))
  54. {
  55. punch = gottaFix.split("\t");
  56. System.out.print(", ");
  57. System.out.print(punch[3].replaceAll(" \\DM", ""));
  58.  
  59. if(punch[0].equals("ES"))
  60. {
  61. if(punch[1].equals("Edited"))
  62. { System.out.println("/, (bank run); ");}
  63. else
  64. { System.out.println(", no bank run; ");}
  65. }
  66. }
  67. }
  68.  
  69. //else
  70. {
  71.  
  72. }
  73. }
  74. }
  75. }
Success #stdin #stdout 0.28s 60352KB
stdin
Punches: Sun Sep 14, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:04 AM	4:46
SB	03660	Normal	2:50 PM	0:11
EB	03660	Normal	3:01 PM	0:19
ES	03660	Normal	3:20 PM
Punches: Mon Sep 15, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:26 AM	4:17
SB	03660	Normal	2:43 PM	0:10
EB	03660	Normal	2:53 PM	0:08
ES	03660	Normal	3:01 PM	
Punches: Tue Sep 16, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	9:49 AM	4:57
SB	03660	Normal	2:46 PM	0:11
EB	03660	Normal	2:57 PM	1:02
ES	03660	Normal	3:59 PM	
Punches: Sun Sep 21, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:00 AM	3:00
ES	03660	Normal	1:00 PM	
Punches: Mon Sep 22, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	9:45 AM	5:19
SB	03660	Normal	3:04 PM	0:07
EB	03660	Normal	3:11 PM	0:01
ES	03660	Normal	3:12 PM	
Punches: Tue Sep 23, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:43 AM	3:03
SB	03660	Normal	1:46 PM	0:10
EB	03660	Normal	1:56 PM	0:11
ES	03660	Normal	2:07 PM	
Punches: Wed Sep 24, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:35 AM	2:54
SB	03660	Normal	1:29 PM	0:11
EB	03660	Normal	1:40 PM	1:27
ES	03660	Normal	3:07 PM
Punches: Sun Sep 28, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:14 AM	2:57
SB	03660	Normal	1:11 PM	0:12
EB	03660	Normal	1:23 PM	1:47
ES	03660	Normal	3:10 PM	
Punches: Mon Sep 29, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	9:58 AM	4:35
SB	03660	Normal	2:33 PM	0:11
EB	03660	Normal	2:44 PM	0:32
ES	03660	Normal	3:16 PM	
Punches: Tue Sep 30, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:23 AM	4:32
SB	03660	Normal	2:55 PM	0:10
EB	03660	Normal	3:05 PM	0:01
ES	03660	Normal	3:06 PM	
Punches: Wed Oct 1, 2025
Type	Store	Status	Time	Hrs
SS	07024	Normal	6:02 PM	3:49
SB	07024	Normal	9:51 PM	0:11
EB	07024	Normal	10:02 PM	0:36
ES	07024	Normal	10:38 PM	
Punches: Sun Oct 5, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:20 AM	3:23
SB	03660	Normal	1:43 PM	0:11
EB	03660	Normal	1:54 PM	1:08
ES	03660	Normal	3:02 PM	
Punches: Mon Oct 6, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:13 AM	3:51
SB	03660	Normal	2:04 PM	0:12
EB	03660	Normal	2:16 PM	0:46
ES	03660	Normal	3:02 PM	
Punches: Tue Oct 7, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	9:45 AM	4:55
SB	03660	Normal	2:40 PM	0:11
EB	03660	Normal	2:51 PM	0:11
ES	03660	Normal	3:02 PM	
Punches: Sun Oct 12, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	10:17 AM	4:24
SB	03660	Normal	2:41 PM	0:12
EB	03660	Normal	2:53 PM	0:10
ES	03660	Normal	3:03 PM	



stdout
From "https://c...content-available-to-author-only...e.com/pwm/action/mobileGetTimesheetPunches"
Sun 09/14, scheduledTime, 10:04, 2:50, 3:01, 3:20, no bank run; 
Mon 09/15, scheduledTime, 10:26, 2:43, 2:53, 3:01, no bank run; 
Tue 09/16, scheduledTime, 9:49, 2:46, 2:57, 3:59, no bank run; 
Sun 09/21, scheduledTime, 10:00, 1:00, no bank run; 
Mon 09/22, scheduledTime, 9:45, 3:04, 3:11, 3:12, no bank run; 
Tue 09/23, scheduledTime, 10:43, 1:46, 1:56, 2:07, no bank run; 
Wed 09/24, scheduledTime, 10:35, 1:29, 1:40, 3:07, no bank run; 
Sun 09/28, scheduledTime, 10:14, 1:11, 1:23, 3:10, no bank run; 
Mon 09/29, scheduledTime, 9:58, 2:33, 2:44, 3:16, no bank run; 
Tue 09/30, scheduledTime, 10:23, 2:55, 3:05, 3:06, no bank run; 
Wed 10/1, scheduledTime, 6:02, 9:51, 10:02, 10:38, no bank run; 
Sun 10/5, scheduledTime, 10:20, 1:43, 1:54, 3:02, no bank run; 
Mon 10/6, scheduledTime, 10:13, 2:04, 2:16, 3:02, no bank run; 
Tue 10/7, scheduledTime, 9:45, 2:40, 2:51, 3:02, no bank run; 
Sun 10/12, scheduledTime, 10:17, 2:41, 2:53, 3:03, no bank run;