Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. Scanner dump = new Scanner(System.in);
  10. String[] info = dump.nextLine().split(",");
  11. Articles full = new Articles(info[0], info[1], info[2]);
  12. int times = dump.nextInt();
  13. while (times+1 > 0) {
  14. String[] input=dump.nextLine().split("\\s+");
  15. if(input[0].equals("Edit:")){
  16. String answer=input[1]+" "+input[2];
  17. full.setContent(answer);
  18. }
  19. if(input[0].equals("ChangeAuthor:")){
  20. String answer=input[1]+" "+input[2];
  21. full.setAuthor(answer);
  22. }
  23. if(input[0].equals("Rename:")){
  24. String answer=input[1]+" "+input[2];
  25. full.setTitle(answer);
  26. }
  27. times--;
  28. }
  29. System.out.println(full.getTitle()+" - "+full.getContent()+": "+full.getAuthor());
  30.  
  31. }
  32.  
  33.  
  34. static class Articles {
  35. public static String getTitle() {
  36. return Title;
  37. }
  38.  
  39. public static void setTitle(String title) {
  40. Title = title;
  41. }
  42.  
  43. public static String getContent() {
  44. return Content;
  45. }
  46.  
  47. public static void setContent(String content) {
  48. Content = content;
  49. }
  50.  
  51. public static String getAuthor() {
  52. return Author;
  53. }
  54.  
  55. public static void setAuthor(String author) {
  56. Author = author;
  57. }
  58.  
  59. public static String Title;
  60. public static String Content;
  61. public static String Author;
  62.  
  63. public Articles(String title, String content, String author) {
  64. Title = title;
  65. Content = content;
  66. Author = author;
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement