File tree 8 files changed +177
-0
lines changed
8 files changed +177
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <classpath >
3
+ <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11" >
4
+ <attributes >
5
+ <attribute name =" module" value =" true" />
6
+ </attributes >
7
+ </classpathentry >
8
+ <classpathentry kind =" src" path =" src" />
9
+ <classpathentry kind =" output" path =" bin" />
10
+ </classpath >
Original file line number Diff line number Diff line change
1
+ /bin /
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <projectDescription >
3
+ <name >P1P2P3</name >
4
+ <comment ></comment >
5
+ <projects >
6
+ </projects >
7
+ <buildSpec >
8
+ <buildCommand >
9
+ <name >org.eclipse.jdt.core.javabuilder</name >
10
+ <arguments >
11
+ </arguments >
12
+ </buildCommand >
13
+ </buildSpec >
14
+ <natures >
15
+ <nature >org.eclipse.jdt.core.javanature</nature >
16
+ </natures >
17
+ </projectDescription >
Original file line number Diff line number Diff line change
1
+ eclipse.preferences.version =1
2
+ encoding//src/P1.java =UTF-8
3
+ encoding//src/P2.java =UTF-8
4
+ encoding//src/P3.java =UTF-8
Original file line number Diff line number Diff line change
1
+ eclipse.preferences.version =1
2
+ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode =enabled
3
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform =11
4
+ org.eclipse.jdt.core.compiler.codegen.unusedLocal =preserve
5
+ org.eclipse.jdt.core.compiler.compliance =11
6
+ org.eclipse.jdt.core.compiler.debug.lineNumber =generate
7
+ org.eclipse.jdt.core.compiler.debug.localVariable =generate
8
+ org.eclipse.jdt.core.compiler.debug.sourceFile =generate
9
+ org.eclipse.jdt.core.compiler.problem.assertIdentifier =error
10
+ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures =disabled
11
+ org.eclipse.jdt.core.compiler.problem.enumIdentifier =error
12
+ org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures =warning
13
+ org.eclipse.jdt.core.compiler.release =enabled
14
+ org.eclipse.jdt.core.compiler.source =11
Original file line number Diff line number Diff line change
1
+
2
+ import java .util .Scanner ;
3
+ public class P1 {
4
+
5
+ public static void main (String [] args )
6
+ {
7
+ Scanner input =new Scanner (System .in );
8
+
9
+ System .out .print ("Please enter n (1..365): " );
10
+ int n =input .nextInt ();
11
+
12
+
13
+ // month 1..6
14
+ if (n >=1 && n <=186 )
15
+ {
16
+ if (n %31 ==0 )
17
+ System .out .println ("month No is : " + (n /31 ));
18
+ else
19
+ System .out .println ("month No is : " + (n /31 + 1 ));
20
+ }
21
+
22
+ // month 6..11
23
+ else if (n >=187 && n <=336 )
24
+ {
25
+ int m =n -186 ;
26
+ if (m %30 ==0 )
27
+ System .out .println ("month No is : " + (m /30 + 6 ));
28
+ else
29
+ System .out .println ("month No is : " + (m /30 + 7 ));
30
+ }
31
+
32
+ // month 12
33
+ else if (n >=337 && n <=366 )
34
+ System .out .println ("month No is : " + 12 );
35
+
36
+ else
37
+ System .out .println ("no answer..." );
38
+
39
+ }
40
+ }
Original file line number Diff line number Diff line change
1
+
2
+ import java .util .Scanner ;
3
+ public class P2 {
4
+
5
+ public static void main (String [] args )
6
+ {
7
+ Scanner input =new Scanner (System .in );
8
+
9
+
10
+ System .out .print ("Please enter n (1..365): " );
11
+ int n =input .nextInt ();
12
+
13
+
14
+ // month 1..6
15
+ if (n >=1 && n <=186 )
16
+ {
17
+ if (n %31 ==0 )
18
+ {
19
+ System .out .println ("month No is : " + (n /31 ));
20
+ System .out .println ("day of month is : " + 31 );
21
+ }
22
+ else
23
+ {
24
+ System .out .println ("month No is : " + (n /31 + 1 ));
25
+ System .out .println ("day of month is : " + n %31 );
26
+ }
27
+ }
28
+
29
+ // month 6..11
30
+ else if (n >=187 && n <=336 )
31
+ {
32
+ int m =n -186 ;
33
+ if (m %30 ==0 )
34
+ {
35
+ System .out .println ("month No is : " + (m /30 + 6 ));
36
+ System .out .println ("day of month is : " + 30 );
37
+ }
38
+ else
39
+ {
40
+ System .out .println ("month No is : " + (m /30 + 7 ));
41
+ System .out .println ("day of month is : " + m %30 );
42
+ }
43
+ }
44
+
45
+ // month 12
46
+ else if (n >=337 && n <=366 )
47
+ {
48
+ System .out .println ("month No is : " + 12 );
49
+ System .out .println ("day of month is : " + (n -336 ));
50
+ }
51
+
52
+ else
53
+ System .out .println ("no answer..." );
54
+
55
+ }
56
+ }
Original file line number Diff line number Diff line change
1
+
2
+ import java .util .Scanner ;
3
+ public class P3 {
4
+
5
+ public static void main (String [] args )
6
+ {
7
+ Scanner input =new Scanner (System .in );
8
+
9
+ System .out .print ("Please enter n to ATM: " );
10
+ int n =input .nextInt ();
11
+
12
+ int r50 =0 ;
13
+ int r10 =0 ;
14
+ int r5 =0 ;
15
+ int r1 =0 ;
16
+
17
+ r50 = n /50 ; //107
18
+
19
+ System .out .println (r50 + " *50" );
20
+
21
+ n = n - r50 * 50 ;
22
+ r10 = n /10 ;
23
+ System .out .println (r10 + " *10" );
24
+
25
+ n = n -r10 *10 ;
26
+
27
+ r5 =n /5 ;
28
+ System .out .println (r5 + " *5" );
29
+
30
+ n = n -r5 *5 ;
31
+ System .out .println (n + " *1" );
32
+
33
+
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments