import java.util.*; import java.io.*; public class Setup { public static void main (String args[]) { Scanner stdin = new Scanner( System.in ); System.out.print( "User id: " ); String s = stdin.next(); String os = System.getProperty( "os.name" ); String uvahome; if ( os.indexOf( "Windows" ) == 0 ) { uvahome = "J:\\"; } else if ( os.indexOf( "Mac" ) == 0 ) { uvahome = "/Volumes/" + s; } else { uvahome = "/home/" + s ; } File public_html = null; try { public_html = new File( uvahome, "public_html" ); if ( ! public_html.exists() ) { boolean made = public_html.mkdir(); if ( ! made ) { System.out.println( "See TAs: public_html cannot be made" ); System.exit( 1 ); } } else if ( ! public_html.isDirectory() ) { System.out.println( "See TAs: public_html is not a folder" ); System.exit( 1 ); } } catch ( Exception e ) { System.out.println( "See TAs: file exception for public_html" ); System.exit( 1 ); } System.out.println( "public_html: is folder" ); File ximu = null; try { ximu = new File( public_html, "ximu" ); if ( ! ximu.exists() ) { boolean made = ximu.mkdir(); if ( ! made ) { System.out.println( "See TAs: ximu cannot be made" ); System.exit( 1 ); } } else if ( ! ximu.isDirectory() ) { System.out.println( "See TAs: ximu is not a folder" ); System.exit( 1 ); } } catch ( Exception e ) { System.out.println( "See TAs: file exception for ximu" ); System.exit( 1 ); } System.out.println( "ximu: is folder" ); try { File status = new File( ximu, "status" ); if ( status.isDirectory() ) { System.out.println( "See TAs: status is a folder" ); System.exit( 1 ); } PrintStream out = new PrintStream( status ); out.println( "gone" ); } catch ( Exception e ) { System.out.println( "See TAs: cannot set up status" ); System.exit( 1 ); } System.out.println( "status: set to gone" ); try { File friends = new File( ximu, "friends" ); if ( friends.isDirectory() ) { System.out.println( "See TAs: friends is a folder" ); System.exit( 1 ); } PrintStream out = new PrintStream( friends ); String list = "acp4q\naje8m\nbcs8d\nbd4t\nblo2j\ncas9rb\ncjh7e\n" + "clz2t\ndhr9p\ndis9d\ndrh7a\ndys8h\nekt8c\ngls9b\nhrm4x\n" + "hyl2n\niak2b\njaa7p\njag5ac\njak6t\njck7x\njea6t\n" + "jmb2ah\njmb3bc\njpc\nkav5y\nkaw2z\nked4p\nkjw6f\nkkk5z\n" + "kmd9q\nlaa2v\nlag4m\nlrm3n\nmar3ak\nmat7p\nmcj8d\n" + "mes5gg\nmjv6b\nmlm5ca\nnlh3z\nnmr9p\nnrk5q\npwb7g\n" + "rmm7z\nrtb9s\nscw6u\nseh5t\nsle5r\nslj4t\ntep5h\nwal3a\n" + "wla6n\ncohoon"; out.println( list ); } catch ( Exception e ) { System.out.println( "See TAs: cannot set up friends" ); System.exit( 1 ); } System.out.println( "friends: set to classmates, tas, and instructor" ); } }