Advertisement
deyanmalinov

02. Articles - part 1

Mar 12th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. package DPM;
  2. import java.util.*;
  3. public class Main {
  4.         public static void main(String[] args) {
  5.             Scanner scan = new Scanner(System.in);
  6.             String [] line = scan.nextLine().split(", ");
  7.             Article art = new Article(line[0], line[1], line[2]);
  8.  
  9.             int num = Integer.parseInt(scan.nextLine());
  10.  
  11.             while (num-- > 0){
  12.                 String [] comand = scan.nextLine().split(": ");
  13.                 String com = comand[0];
  14.                 if (com.equals("Edit")){
  15.                     art.edit(comand[1]);
  16.                 }else if (com.equals("ChangeAuthor")){
  17.                     art.changeAuthor(comand[1]);
  18.                 }else{
  19.                     art.rename(comand[1]);
  20.                 }
  21.  
  22.             }
  23.  
  24.             System.out.printf("%s - %s: %s", art.getTitle(), art.getContent(), art.getAuthor());
  25.         }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement