Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner dump = new Scanner(System.in);
- String[] info = dump.nextLine().split(",");
- Articles full = new Articles(info[0], info[1], info[2]);
- int times = dump.nextInt();
- while (times+1 > 0) {
- String[] input=dump.nextLine().split("\\s+");
- if(input[0].equals("Edit:")){
- String answer=input[1]+" "+input[2];
- full.setContent(answer);
- }
- if(input[0].equals("ChangeAuthor:")){
- String answer=input[1]+" "+input[2];
- full.setAuthor(answer);
- }
- if(input[0].equals("Rename:")){
- String answer=input[1]+" "+input[2];
- full.setTitle(answer);
- }
- times--;
- }
- System.out.println(full.getTitle()+" - "+full.getContent()+": "+full.getAuthor());
- }
- static class Articles {
- public static String getTitle() {
- return Title;
- }
- public static void setTitle(String title) {
- Title = title;
- }
- public static String getContent() {
- return Content;
- }
- public static void setContent(String content) {
- Content = content;
- }
- public static String getAuthor() {
- return Author;
- }
- public static void setAuthor(String author) {
- Author = author;
- }
- public static String Title;
- public static String Content;
- public static String Author;
- public Articles(String title, String content, String author) {
- Title = title;
- Content = content;
- Author = author;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement