Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.03 KB | None | 0 0
  1. public static void menu(){
  2. String a, name, password;
  3. Boolean editor;
  4.  
  5. InputStreamReader input = new InputStreamReader(System.in);
  6. BufferedReader reader = new BufferedReader(input);
  7.  
  8. while(true){
  9. String message;
  10. //something --> mensagem a receber e analisar
  11.  
  12. System.out.print("\nType login or register\n> ");
  13. a = reader.readLine();
  14. if(a.equals("login")){
  15. System.out.print("\nWhat is your username?\n> ");
  16. name = reader.readLine();
  17. System.out.print("\nWhat is your password?\n> ");
  18. password = reader.readLine();
  19.  
  20. //verificar a info
  21.  
  22. if (something.equals("no")){//informação errada
  23. System.out.println("\nWrong information, try again");
  24. continue;
  25. }
  26. else if (something.equals("yes")){
  27. System.out.println("\nStatus Logged | Welcome back to DropMusic");
  28.  
  29. if(something.equals("yes")){
  30. editor = true;
  31. //c.setEditor(true);
  32. }
  33. else{
  34. editor = false;
  35. //c.setEditor(false);
  36. }
  37.  
  38. //c.setUsername(name);
  39. }
  40. }
  41. else if(a.equals("register")){
  42. System.out.print("\nWhat is your username?\n> ");
  43. name = reader.readLine();
  44. System.out.print("\nWhat is your password? \n> ");
  45. password = reader.readLine();
  46.  
  47. //verificar a info
  48.  
  49. if (something.equals("no")){
  50. System.out.println("Username already exists, try again");
  51. continue;
  52. }
  53. else if (something.equals("yes")){
  54. System.out.println("\nStatus Subscribed | Welcome to DropMusic");
  55.  
  56. //c.setUsername(name);
  57. }
  58. }
  59. else{
  60. System.out.println("Something went wrong, try again");
  61. continue;
  62. }
  63. }
  64.  
  65.  
  66. while(true){
  67. System.out.println("\n1- Search song");
  68. System.out.println("2- Details of an album");
  69. System.out.println("3- Details of an artist");
  70. System.out.println("4- Write a review of an album");
  71. System.out.println("5- Share with friends uploaded song");
  72. if (/*c.getEditor()*/) {
  73. System.out.println("6- Manage information");
  74. System.out.println("7- Make an user a new editor");
  75. }
  76. System.out.println("0- Logout");
  77. System.out.print("> ");
  78. Scanner sc = new Scanner(System.in);
  79. String num = sc.next();
  80.  
  81. switch(num){
  82. case "1":
  83. System.out.println("\n1- Trough artist");
  84. System.out.println("2- Trough album");
  85. System.out.print("3- By song name\n> ");
  86. String aux1 = sc.next();
  87. String artist11 = "";
  88. switch(aux1){
  89. case "1":
  90. System.out.print("\nType artist's name:\n> ");
  91. artist11 = reader.readLine();
  92.  
  93. //procurar artista
  94.  
  95. if(something.equals("yes-artist")){
  96. System.out.print("\nChoose one song:\n> ");
  97. String song11 = reader.readLine();
  98. System.out.println("\n1- Duration");
  99. System.out.println("2- Composer");
  100. System.out.println("3- Lyrics");
  101. System.out.println("4- Upload");
  102. System.out.print("5- Download\n> ");
  103. String aux11 = reader.readLine();
  104.  
  105. switch(aux11){
  106. case "1":
  107. //send message
  108. continue;
  109. case "2":
  110. //send message
  111. continue;
  112. case "3":
  113. //send message
  114. continue;
  115. case "4":
  116. //send message
  117. continue;
  118. case "5":
  119. //send message
  120. continue;
  121. default:
  122. continue;
  123. }
  124. }
  125. else{
  126. continue;
  127. }
  128. case "2":
  129. System.out.print("\nType album's name:\n> ");
  130. String album12 = reader.readLine();
  131.  
  132. //procurar album
  133.  
  134. if(something.equals("yes-album")){
  135. System.out.print("\nChoose one song:\n> ");
  136. String song12 = reader.readLine();
  137. System.out.println("\n1- Duration");
  138. System.out.println("2- Composer");
  139. System.out.println("3- Lyrics");
  140. System.out.println("4- Upload");
  141. System.out.print("5- Download\n> ");
  142. String aux12 = reader.readLine();
  143.  
  144. switch(aux12){
  145. case "1":
  146. //send message
  147. continue;
  148. case "2":
  149. //send message
  150. continue;
  151. case "3":
  152. //send message
  153. continue;
  154. case "4":
  155. //send message
  156. continue;
  157. case "5":
  158. //send message;
  159. default:
  160. continue;
  161. }
  162. }
  163. else{
  164. continue;
  165. }
  166. case "3":
  167. System.out.print("\nType song's name:\n> ");
  168. String song13 = reader.readLine();
  169. System.out.println("\n1- Duration");
  170. System.out.println("2- Composer");
  171. System.out.println("3- Lyrics");
  172. System.out.println("4- Upload");
  173. System.out.print("5- Download\n> ");
  174. String aux13 = reader.readLine();
  175.  
  176. switch(aux13){
  177. case "1":
  178. //send message
  179. continue;
  180. case "2":
  181. //send message
  182. continue;
  183. case "3":
  184. //send message
  185. continue;
  186. case "4":
  187. //send message;
  188. case "5":
  189. //send message
  190. continue;
  191. default:
  192. continue;
  193. }
  194. default:
  195. continue;
  196. }
  197. case "2":
  198. System.out.print("\nType artist's name:\n> ");
  199. String artist2 = reader.readLine();
  200. System.out.print("\nType album's name:\n> ");
  201. String album2 = reader.readLine();
  202. System.out.println("\n1- Description");
  203. System.out.println("2- List of songs");
  204. System.out.print("3- Reviews\n> ");
  205. String aux2 = sc.next();
  206. switch(aux2){
  207. case "1":
  208. //send message
  209. continue;
  210. case "2":
  211. //send message
  212. continue;
  213. case "3":
  214. //send message
  215. continue;
  216. default:
  217. continue;
  218. }
  219. case "3":
  220. System.out.print("\nType artist's name:\n> ");
  221. String artist3 = reader.readLine();
  222. //send message
  223. continue;
  224. case "4":
  225. System.out.print("\nType album's name:\n> ");
  226. String album4 = reader.readLine();
  227.  
  228. String score4 = null;
  229. while(true){
  230. System.out.print("\nType album's score (0 to 10):\n> ");
  231. score4 = reader.readLine();
  232. try{
  233. int score41 = Integer.parseInt(score4);
  234. if(score41>=0 && score41<=10){
  235. break;
  236. }
  237. else{
  238. System.out.println("That input is invalid");
  239. continue;
  240. }
  241. }
  242. catch(NumberFormatException e){
  243. System.out.println("That input is invalid");
  244. continue;
  245. }
  246. }
  247.  
  248. System.out.print("\nWrite review (300 characters):\n> ");
  249. String review4 = reader.readLine();
  250. String review42;
  251. if(review4.length()>300)
  252. review42 = review4.substring(0,300);
  253. else
  254. review42 = review4;
  255.  
  256. //send message
  257. continue;
  258. case "5":
  259. System.out.print("\nType album's name:\n> ");
  260. String album5 = reader.readLine();
  261. System.out.print("\nType song's name:\n> ");
  262. String song5 = reader.readLine();
  263. System.out.println("\nType your friends usernames (write BREAK to end):");
  264. String user_friends5 = "";
  265. while(true){
  266. System.out.print(">");
  267. String friend5 = reader.readLine();
  268. if (friend5.equals("BREAK")){
  269. break;
  270. }
  271. else{
  272. user_friends5 += friend5 + "//";
  273. continue;
  274. }
  275. }
  276. //send message
  277. continue;
  278. case "6":
  279. if(/*c.getEditor()*/){
  280. System.out.println("\n1- Insert");
  281. System.out.print("2- Change\n> ");
  282. String aux8 = sc.next();
  283. switch(aux8){
  284. case "1":
  285. System.out.println("\n1- Artist");
  286. System.out.println("2- Album");
  287. System.out.print("3- Song\n> ");
  288. String aux81 = sc.next();
  289. switch(aux81){
  290. case "1":
  291. System.out.print("\nType artist's name:\n> ");
  292. String artist811 = reader.readLine();
  293. System.out.print("\nType artist's description:\n> ");
  294. String description811 = reader.readLine();
  295. System.out.print("\nType artist's working period:\n> ");
  296. String period811 = reader.readLine();
  297.  
  298. //send message
  299. continue;
  300. case "2":
  301. System.out.print("\nType artist's name:\n> ");
  302. String artist812 = reader.readLine();
  303. System.out.print("\nType album's name:\n> ");
  304. String album812 = reader.readLine();
  305. System.out.print("\nType album's genre:\n> ");
  306. String genre812 = reader.readLine();
  307. System.out.print("\nType album's description:\n> ");
  308. String description812 = reader.readLine();
  309. System.out.print("\nType album's date:\n> ");
  310. String date812 = reader.readLine();
  311.  
  312. //send message
  313. continue;
  314. case "3":
  315. System.out.print("\nType artist's name:\n> ");
  316. String artist813 = reader.readLine();
  317. System.out.print("\nType album's name:\n> ");
  318. String album813 = reader.readLine();
  319. System.out.print("\nType song's name:\n> ");
  320. String song813 = reader.readLine();
  321. System.out.print("\nType song's duration:\n> ");
  322. String duration813 = reader.readLine();
  323. System.out.print("\nType song's composer:\n> ");
  324. String composer813 = reader.readLine();
  325. System.out.print("\nType song's lyrics:\n> ");
  326. String lyrics813 = reader.readLine();
  327.  
  328. //send message
  329. continue;
  330. default:
  331. continue;
  332. }
  333. case "2":
  334. System.out.println("\n1- Artist");
  335. System.out.println("2- Album");
  336. System.out.print("3- Song\n> ");
  337. String aux82 = sc.next();
  338. switch(aux82){
  339. case "1":
  340. System.out.println("\n1- Artist's name");
  341. System.out.println("2- Artist's description");
  342. System.out.print("3- Artist's working period\n> ");
  343. String aux821 = reader.readLine();
  344.  
  345. System.out.print("\nType artist's name:\n> ");
  346. String artist821 = reader.readLine();
  347. switch(aux821){
  348. case "1":
  349. System.out.print("\nType artist's new name:\n> ");
  350. String newartist8211 = reader.readLine();
  351. //send message
  352. continue;
  353. case "2":
  354. System.out.print("\nType artist's new description:\n> ");
  355. String newd8212 = reader.readLine();
  356. //send message
  357. continue;
  358. case "3":
  359. System.out.print("\nType artist's new working period:\n> ");
  360. String newp8213 = reader.readLine();
  361. //send message
  362. continue;
  363. default:
  364. continue;
  365. }
  366. case "2":
  367. System.out.println("\n1- Album's name");
  368. System.out.println("2- Album's description");
  369. System.out.println("3- Album's genre");
  370. System.out.print("4- Album's date\n> ");
  371. String aux822 = reader.readLine();
  372.  
  373. System.out.print("\nType artist's name:\n> ");
  374. String artist822 = reader.readLine();
  375. System.out.print("\nType album's name:\n> ");
  376. String album822 = reader.readLine();
  377. switch(aux822){
  378. case "1":
  379. System.out.print("\nType album's new name:\n> ");
  380. String newalbum8221 = reader.readLine();
  381. //send message
  382. continue;
  383. case "2":
  384. System.out.print("\nType album's new description:\n> ");
  385. String newdesc8222 = reader.readLine();
  386. //send message
  387. continue;
  388. case "3":
  389. System.out.print("\nType album's new genre:\n> ");
  390. String newgenre8223 = reader.readLine();
  391. //send message
  392. continue;
  393. case "4":
  394. System.out.print("\nType album's new date:\n> ");
  395. String newdate8224 = reader.readLine();
  396. //send message
  397. continue;
  398. default:
  399. continue;
  400. }
  401. case "3":
  402. System.out.println("\n1- Song's name");
  403. System.out.println("2- Song's duration");
  404. System.out.println("3- Songs's composer");
  405. System.out.print("4- Song's lyrics\n> ");
  406. String aux823 = reader.readLine();
  407.  
  408. System.out.print("\nType artist's name:\n> ");
  409. String artist823 = reader.readLine();
  410. System.out.print("\nType album's name:\n> ");
  411. String album823 = reader.readLine();
  412. System.out.print("\nType song's name:\n> ");
  413. String song823 = reader.readLine();
  414. switch(aux823){
  415. case "1":
  416. System.out.print("\nType song's new name:\n> ");
  417. String newsong8231 = reader.readLine();
  418. //send message
  419. continue;
  420. case "2":
  421. System.out.print("\nType song's new duration:\n> ");
  422. String newdur8232 = reader.readLine();
  423. //send message
  424. continue;
  425. case "3":
  426. System.out.print("\nType song's new composer:\n> ");
  427. String newcomp8233 = reader.readLine();
  428. //send message
  429. continue;
  430. case "4":
  431. System.out.print("\nType song's new lyrics:\n> ");
  432. String newlyrics8234 = reader.readLine();
  433. //send message
  434. continue;
  435. default:
  436. continue;
  437. }
  438. default:
  439. continue;
  440. }
  441. default:
  442. continue;
  443. }
  444. }
  445. else{
  446. continue;
  447. }
  448. case "7":
  449. if(c.getEditor()){
  450. System.out.print("\nType username:\n> ");
  451. String user9 = reader.readLine();
  452. //send message
  453. continue;
  454. }
  455. else
  456. continue;
  457. case "0":
  458. System.exit(0);
  459. default:
  460. continue;
  461. }
  462. }
  463. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement