-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPath.java
More file actions
64 lines (61 loc) · 1.44 KB
/
Path.java
File metadata and controls
64 lines (61 loc) · 1.44 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import java.util.Scanner;
public class Path
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
String file = scan.next();
int item;
char c = file.charAt(0);
char n = file.charAt(file.length()-1);
String finalPart;
System.out.print("/itemList/");
if(c == 'i')
{
item = Character.getNumericValue(n)-1;
System.out.print("items[" + item + "]");
System.out.print("/id");
}
else if( c == 'I')
{
item = Character.getNumericValue(n)-1;
System.out.print("items[" + item + "]");
System.out.print("/label");
}
else if( (c == 's') && ((file.length() > 10) || (file.length()< 6)))
{
item = Character.getNumericValue(n)-1;
if(Character.getNumericValue(n) == 1)
{
System.out.print("items[5]/id/subItem1/subitems[" + item + "]/id");
}
else if(Character.getNumericValue(n) == 2)
{
System.out.print("items[8]/id/subItem2/subitems[" + item + "]/id");
}
}
else if( (c == 's') && (file.length() == 8))
{
if(Character.getNumericValue(n) == 1)
{
System.out.print("items[5]/id");
}
else if(Character.getNumericValue(n) == 2)
{
System.out.print("items[8]/id");
}
}
else if( (c == 'S') )
{
item = Character.getNumericValue(n)-1;
if(Character.getNumericValue(n) == 1)
{
System.out.print("items[5]/id/subItem1/subitems[" + item + "]/label");
}
else if(Character.getNumericValue(n) == 2)
{
System.out.print("items[8]/id/subItem2/subitems[" + item + "]/label");
}
}
}
}