Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Tester {
- public static void main(String[] args) {
- String title = "";
- String author = "";
- String id = "";
- String year = "";
- String length = "";
- String genre = "";
- String command = "";
- // Constructors for the objects utilize all the methods
- Scanner scanner = new Scanner(System.in);
- System.out.println("Creating Book...");
- System.out.print("Please input book title: ");
- title = scanner.nextLine();
- System.out.print("Please input book id: ");
- id = scanner.nextLine();
- System.out.print("Please input book author: ");
- author = scanner.nextLine();
- Book book = new Book(id, title, author);
- System.out.println("");
- System.out.println("Creating Magazine...");
- System.out.print("Please input magazine title: ");
- title = scanner.nextLine();
- System.out.print("Please input magazine id: ");
- id = scanner.nextLine();
- System.out.print("Please input magazine year: ");
- year = scanner.nextLine();
- Magazine magazine = new Magazine(id, title, year);
- System.out.println("");
- System.out.println("Creating Video...");
- System.out.print("Please input video title: ");
- title = scanner.nextLine();
- System.out.print("Please input video id: ");
- id = scanner.nextLine();
- System.out.print("Please input video length: ");
- length = scanner.nextLine();
- Video video = new Video(id, title, length);
- System.out.println("");
- System.out.println("Creating CD...");
- System.out.print("Please input CD title: ");
- title = scanner.nextLine();
- System.out.print("Please input CD id: ");
- id = scanner.nextLine();
- System.out.print("Please input CD genre: ");
- genre = scanner.nextLine();
- CD cd = new CD(id, title, genre);
- System.out.println("");
- System.out.println(book);
- System.out.println(magazine);
- System.out.println(cd);
- System.out.println(video);
- scanner.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement