-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathchopin.java
More file actions
38 lines (30 loc) · 704 Bytes
/
Copy pathchopin.java
File metadata and controls
38 lines (30 loc) · 704 Bytes
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
import java.util.Scanner;
public class chopin {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int cases = 1;
while (scan.hasNext())
{
String[] notes = {"A#" , "Bb" , "C#" , "Db" , "D#" , "Eb" , "F#" , "Gb" , "G#" , "Ab"};
String str = scan.next();
String tonality = scan.next();
System.out.print("Case " + cases + ": ");
if (str.length() == 1)
System.out.println("UNIQUE");
else
{
for (int i = 0; i < notes.length; i++)
if (str.equals(notes[i]))
{
if (i % 2 == 0)
System.out.print(notes[i + 1] + " ");
else
System.out.print(notes[i - 1] + " ");
}
System.out.println(tonality);
}
cases++;
}
scan.close();
}
}