Last login: Mon Oct 25 12:44:39 on ttys002 The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. MAC:Mon Oct 25:12:59:~> cd Desktop/ MAC:Mon Oct 25:12:59:Desktop> cp Screen\ Shot\ 2021-10-25\ at\ 12.59.34\ PM.png classInConsole.jpg MAC:Mon Oct 25:13:00:Desktop> mv classInConsole.jpg classInConsole.png MAC:Mon Oct 25:13:00:Desktop> sftp utility0 Connected to utility0. sftp> put class* Uploading classInConsole.png to /home/morrison/classInConsole.png classInConsole.png 100% 165KB 4.5MB/s 00:00 sftp> quit MAC:Mon Oct 25:13:00:Desktop> B MAC:Mon Oct 25:14:00:4240> ls 0820.txt 0909F def square(x):.py 0820F.txt 0914 fun.py 0824B.txt 0915F hello.py 0824BPython.txt 1001 interfaces 0825F.txt 1006.txt rec 0826B.txt 1007F.txt rec.py 0826BPart2.txt 1014 roster.txt 0826F.txt BigFraction.java run_tests.py 0827B BigFraction.py stringPlay 0831F LP0 students 0902B Lab1 test_lint.py 0902F Terminal Saved Output.txt tutorial.txt 0908F Vector3D 0909B debug MAC:Mon Oct 25:14:00:4240> cd interfaces/ MAC:Mon Oct 25:14:00:interfaces> ls Circle.class Circle.java Rectangle.class Rectangle.java Shape.class Shape.java MAC:Mon Oct 25:14:00:interfaces> mkdir F MAC:Mon Oct 25:14:00:interfaces> cd F MAC:Mon Oct 25:14:00:F> wget https://faculty.ncssm.edu/~morrison/currentClasses/4240/Oct/25Oct21/F/Rectangle.java --2021-10-25 14:01:15-- https://faculty.ncssm.edu/~morrison/currentClasses/4240/Oct/25Oct21/F/Rectangle.java SSL_INIT Resolving faculty.ncssm.edu (faculty.ncssm.edu)... 192.154.43.11 Connecting to faculty.ncssm.edu (faculty.ncssm.edu)|192.154.43.11|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 448 [text/plain] Saving to: ‘Rectangle.java’ Rectangle.java 100%[================================>] 448 --.-KB/s in 0s 2021-10-25 14:01:15 (38.8 MB/s) - ‘Rectangle.java’ saved [448/448] MAC:Mon Oct 25:14:01:F> wget https://faculty.ncssm.edu/~morrison/currentClasses/4240/Oct/25Oct21/F/Shape.java --2021-10-25 14:01:23-- https://faculty.ncssm.edu/~morrison/currentClasses/4240/Oct/25Oct21/F/Shape.java SSL_INIT Resolving faculty.ncssm.edu (faculty.ncssm.edu)... 192.154.43.11 Connecting to faculty.ncssm.edu (faculty.ncssm.edu)|192.154.43.11|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 114 [text/plain] Saving to: ‘Shape.java’ Shape.java 100%[================================>] 114 --.-KB/s in 0s 2021-10-25 14:01:23 (13.6 MB/s) - ‘Shape.java’ saved [114/114] MAC:Mon Oct 25:14:01:F> ls Rectangle.java Shape.java MAC:Mon Oct 25:14:01:F> jshell | Welcome to JShell -- Version 17 | For an introduction type: /help intro jshell> ls | Error: | cannot find symbol | symbol: variable ls | ls | ^^ jshell> /open Shape.java jshell> /open Rectangle.java jshell> Rectangle r = new Rectangle(6,8); r ==> Rectangle@6e8cf4c6 jshell> r.diameter() $4 ==> 10.0 jshell> r.perimeter() $5 ==> 28.0 jshell> r.area() $6 ==> 48.0 jshell> Shape s = new Rectangle(6,8); s ==> Rectangle@27bc2616 jshell> /exit | Goodbye MAC:Mon Oct 25:14:09:F> wget https://faculty.ncssm.edu/~morrison/currentClasses/4240/Oct/25Oct21/F/Circle.java --2021-10-25 14:09:34-- https://faculty.ncssm.edu/~morrison/currentClasses/4240/Oct/25Oct21/F/Circle.java SSL_INIT Resolving faculty.ncssm.edu (faculty.ncssm.edu)... 192.154.43.11 Connecting to faculty.ncssm.edu (faculty.ncssm.edu)|192.154.43.11|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 359 [text/plain] Saving to: ‘Circle.java’ Circle.java 100%[==============================>] 359 --.-KB/s in 0s 2021-10-25 14:09:34 (34.2 MB/s) - ‘Circle.java’ saved [359/359] MAC:Mon Oct 25:14:09:F> ls Circle.java Rectangle.java Shape.java MAC:Mon Oct 25:14:09:F> jshell | Welcome to JShell -- Version 17 | For an introduction type: /help intro jshell> /open Shape.java jshell> /open Circle.java jshell> /open Recangle.java | File 'Recangle.java' for '/open' is not found. jshell> /open Rectangle.java jshell> Shape s = new Shape(); | Error: | Shape is abstract; cannot be instantiated | Shape s = new Shape(); | ^---------^ jshell> ArrayList al = new ArrayList<>(); al ==> [] jshell> al.add(new Rectangle(6,8)); $5 ==> true jshell> al.add(new Circle(8)); $6 ==> true jshell> al al ==> [Rectangle@27973e9b, Circle@312b1dae] jshell> List ell = new ArrayList<>(); ell ==> [] jshell> ell.add("z"); $9 ==> true jshell> ell.add("q"); $10 ==> true jshell> ell.add("a"); $11 ==> true jshell> ell ell ==> [z, q, a] jshell> Collections.sort(ell); jshell> ell ell ==> [a, q, z] jshell> ell.add("Z"); $15 ==> true jshell> ell.add("A"); $16 ==> true jshell> Collections.sort(ell); jshell> ell ell ==> [A, Z, a, q, z] jshell> Collections.sort(ell, String::compareToIgnoreCase); jshell> ell ell ==> [A, a, q, Z, z] jshell> TreeMap tm = new TreeMap<>(); tm ==> {} jshell> tm["cats"] = 5; | Error: | incompatible types: java.lang.String cannot be converted to int | tm["cats"] = 5; | ^----^ | Error: | array required, but java.util.TreeMap found | tm["cats"] = 5; | ^--------^ jshell> tm.put("cats", 5); $22 ==> null jshell> tm tm ==> {cats=5} jshell> tm.put("dogs", 12); $24 ==> null jshell> tm.put("ibex", 3); $25 ==> null jshell> tm tm ==> {cats=5, dogs=12, ibex=3} jshell> Map = new TreeMap<>(); | Error: | ';' expected | Map = new TreeMap<>(); | ^ | Error: | illegal start of expression | Map = new TreeMap<>(); | ^ | Error: | cannot find symbol | symbol: variable Map | Map = new TreeMap<>(); | ^-^ | Error: | cannot find symbol | symbol: variable Shape | Map = new TreeMap<>(); | ^---^ | Error: | cannot find symbol | symbol: variable Integer | Map = new TreeMap<>(); | ^-----^ jshell> Map quack = new TreeMap<>(); quack ==> {} jshell> tm.put(new Circle(5), 10) | Error: | incompatible types: Circle cannot be converted to java.lang.String | tm.put(new Circle(5), 10) | ^-----------^ jshell> quack.put(new Circle(5), 10) | Exception java.lang.ClassCastException: class REPL.$JShell$12$Circle cannot be cast to class java.lang.Comparable (REPL.$JShell$12$Circle is in unnamed module of loader jdk.jshell.execution.DefaultLoaderDelegate$RemoteClassLoader @3cd1a2f1; java.lang.Comparable is in module java.base of loader 'bootstrap') | at TreeMap.compare (TreeMap.java:1569) | at TreeMap.addEntryToEmptyMap (TreeMap.java:776) | at TreeMap.put (TreeMap.java:785) | at TreeMap.put (TreeMap.java:534) | at (#28:1) jshell> Map q = new HashMap<>(); q ==> {} jshell> q.put(new Circle(5), "circle with radius 5"); $30 ==> null jshell> q q ==> {Circle@3f8f9dd6=circle with radius 5} jshell>