Skip to content

Commit c978d1f

Browse files
committed
4-3
1 parent 4fb3fcf commit c978d1f

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

ch04/ExerciseFourPointThree.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
public class ExerciseFourPointThree
2+
{
3+
public static void main(String args[])
4+
{
5+
String day = "Thursday";
6+
int date = 18;
7+
String month = "January";
8+
int year = 2018;
9+
10+
printAmerican(day, date, month, year);
11+
12+
printEuropean(day, date, month, year);
13+
14+
}
15+
16+
public static void printAmerican(String day, int date, String month, int year)
17+
{
18+
System.out.println("American format:");
19+
20+
System.out.print(day);
21+
System.out.print(", ");
22+
System.out.print(month);
23+
System.out.print(" ");
24+
System.out.print(date);
25+
System.out.print(", ");
26+
System.out.println(year);
27+
28+
}
29+
30+
public static void printEuropean(String day, int date, String month, int year)
31+
{
32+
System.out.println("European format:");
33+
34+
System.out.print(day);
35+
System.out.print(" ");
36+
System.out.print(date);
37+
System.out.print(" ");
38+
System.out.print(month);
39+
System.out.print(" ");
40+
System.out.println(year);
41+
}
42+
}

0 commit comments

Comments
 (0)