Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.Vector;
- import java.util.Collections;
- public class assignment9
- {
- public static Vector<String> entire_cast = new Vector<String>();
- public static String[] preset_cast = {"Hugh Laurie as Greg House" ,
- "Robert Sean Leonard as Jamies Wilson",
- "Lisa Edelstein as Lisa Cuddy",
- "Omar Epps as Eric Foreman",
- "Jennifer Morrison as Allison Cameron",
- "Jesse Spencer as Robert Chase", "Ovivia Wilde as Dr. Hadley aka Thirteen",
- "Kal Penn as Lawrence Kutner",
- "Anne Dudek as Amber Volakis",
- "Sela Ward as Stacy Warner",
- "Peter Jacobson as Chris Taub"
- };
- public void create_default_cast()
- {
- //header
- System.out.println();
- System.out.println();
- System.out.println("________________________________________");
- System.out.println("**** Cast of House MD ****");
- System.out.println("________________________________________");
- System.out.println();
- System.out.println();
- //end header
- for(String addcast : preset_cast)
- {
- entire_cast.add(addcast);
- }
- }
- public void print_cast()
- {
- Collections.sort(entire_cast);
- for(String cast:entire_cast)
- {
- System.out.println(cast);
- }
- }
- public void add_cast_member(String RealName, String StageName)
- {
- String Combine = RealName + " as " + StageName;
- entire_cast.add(Combine);
- System.out.println();
- System.out.println();
- print_cast();
- addAnother();
- }
- public void getName()
- {
- try
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- System.out.println();
- System.out.println("Ready to join the cast? Whats your name?");
- String getRealName = reader.readLine();
- System.out.println();
- System.out.println("Great! What will be your characters name?");
- String getStageName = reader.readLine();
- add_cast_member(getRealName, getStageName);
- reader.close();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- public void addAnother()
- {
- try
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- System.out.println();
- System.out.println("Would you like to add another? ('yes' to continue adding)");
- String toContinue = reader.readLine();
- String sendtrue = "yes";
- if(toContinue.compareTo(sendtrue) >= 0)
- {
- getName();
- }
- else
- {
- System.out.println("Bye!");
- }
- reader.close();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- public static void main(String[] args)
- {
- assignment9 initialize = new assignment9();
- initialize.create_default_cast();
- initialize.print_cast();
- initialize.getName();
- }
- }
Add Comment
Please, Sign In to add comment