Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57361a8

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first commit
0 parents  commit57361a8

File tree

8 files changed

+177
-0
lines changed

8 files changed

+177
-0
lines changed

‎P1P2P3/.classpath

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentrykind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
4+
<attributes>
5+
<attributename="module"value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentrykind="src"path="src"/>
9+
<classpathentrykind="output"path="bin"/>
10+
</classpath>

‎P1P2P3/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

‎P1P2P3/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
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
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

‎P1P2P3/src/P1.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
importjava.util.Scanner;
3+
publicclassP1 {
4+
5+
publicstaticvoidmain(String[]args)
6+
{
7+
Scannerinput=newScanner (System.in);
8+
9+
System.out.print("Please enter n (1..365): ");
10+
intn=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+
elseif (n>=187 &&n<=336)
24+
{
25+
intm=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+
elseif (n>=337 &&n<=366)
34+
System.out.println("month No is : " +12);
35+
36+
else
37+
System.out.println("no answer...");
38+
39+
}
40+
}

‎P1P2P3/src/P2.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
importjava.util.Scanner;
3+
publicclassP2 {
4+
5+
publicstaticvoidmain(String[]args)
6+
{
7+
Scannerinput=newScanner (System.in);
8+
9+
10+
System.out.print("Please enter n (1..365): ");
11+
intn=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+
elseif (n>=187 &&n<=336)
31+
{
32+
intm=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+
elseif (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+
}

‎P1P2P3/src/P3.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
importjava.util.Scanner;
3+
publicclassP3 {
4+
5+
publicstaticvoidmain(String[]args)
6+
{
7+
Scannerinput=newScanner (System.in);
8+
9+
System.out.print("Please enter n to ATM: ");
10+
intn=input.nextInt();
11+
12+
intr50=0;
13+
intr10=0;
14+
intr5=0;
15+
intr1=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+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp