OpKaTa

Untitled

Feb 21st, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package ArticleProblem;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7. Scanner scan = new Scanner(System.in);
  8.  
  9. String[] input =scan.nextLine().split(", ");
  10.  
  11. String title = input[0];
  12. String content = input[1];
  13. String author = input[2];
  14. Article article = new Article(title, content, author);
  15. int n = Integer.parseInt(scan.nextLine());
  16.  
  17. for (int i = 0; i < n; i++) {
  18. input= scan.nextLine().split(": ");
  19. String command = input[0];
  20. switch (command){
  21. case "Edit":
  22. article.edit(input[1]);
  23. break;
  24. case "ChangeAuthor":
  25. article.changeAuthor(input[1]);
  26. break;
  27. case "Rename":
  28. article.rename(input[1]);
  29. break;
  30.  
  31. }
  32.  
  33. }
  34. System.out.println(article);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment