-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRomero.java
43 lines (38 loc) · 1.19 KB
/
Romero.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.util.*;
import java.io.*;
import static java.lang.System.*;
public class Romero {
static Scanner sc;
public static void main(String[] args) throws FileNotFoundException {
sc = new Scanner(new File("romero.dat"));
int T = 1;
// T = sc.nextInt();
while(T-->0) solve();
}
static void solve() {
int n = sc.nextInt();
out.println("Date Attendance Gross ATP STP Adults Stu/Child|");
while(n-->0) {
String s = sc.next();
out.printf("%-18s ", date(s));
int attendance = sc.nextInt();
double gross = sc.nextDouble();
double atp = sc.nextDouble(), stp = sc.nextDouble();
out.printf("%-10d ", attendance);
out.printf("$%-,9.2f ", gross);
out.printf("$%-4.2f $%-4.2f ", atp, stp);
double student = (gross - atp * attendance) / (stp - atp);
double adult = attendance - student;
out.printf("%-6d %-9d|", (int) adult, (int) student);
out.println();
}
}
static String date(String s) {
String[] arr = s.split("/");
String[] months = new String[]{"", "", "", "", "", "", "", ""
, "", "September", "October", "November", "December"};
String ans = months[Integer.parseInt(arr[0])] + " " +
arr[1] + ", " + arr[2];
return ans;
}
}