(base) MAC:Sun Aug 30:11:59:book> ssh utility0 Last login: Fri Aug 28 14:04:48 2020 from 192.168.119.46 SERVER:Mon Aug 31:08:04:~> A SERVER:Mon Aug 31:08:04:4260> cd Aug/27Aug20/ SERVER:Mon Aug 31:08:04:27Aug20> ls index.php Point.java SERVER:Mon Aug 31:08:04:27Aug20> vi Point.java SERVER:Mon Aug 31:08:04:27Aug20> cp Point.java ../31Aug20/ SERVER:Mon Aug 31:08:04:27Aug20> cd ../31Aug20/ SERVER:Mon Aug 31:08:04:31Aug20> ls index.php Point.java SERVER:Mon Aug 31:08:04:31Aug20> vi Point.java SERVER:Mon Aug 31:08:05:31Aug20> vi index.php SERVER:Mon Aug 31:08:32:31Aug20> vi Finality.java SERVER:Mon Aug 31:08:33:31Aug20> makeJava.py Finality date=31, month = 8, year = 2020 SERVER:Mon Aug 31:08:33:31Aug20> vi Finality.java SERVER:Mon Aug 31:08:34:31Aug20> javac Finality.java Finality.java:16: error: cannot assign a value to final variable x x++; ^ 1 error SERVER:Mon Aug 31:08:34:31Aug20> !vi vi Finality.java SERVER:Mon Aug 31:08:36:31Aug20> !javac javac Finality.java SERVER:Mon Aug 31:08:36:31Aug20> java Finality 5 [hello] SERVER:Mon Aug 31:08:36:31Aug20> !vi vi Finality.java SERVER:Mon Aug 31:08:38:31Aug20> vi index.php SERVER:Mon Aug 31:08:45:31Aug20> cp Point.java Point1.java SERVER:Mon Aug 31:08:45:31Aug20> vi Point1.java SERVER:Mon Aug 31:08:46:31Aug20> javac Point1.java SERVER:Mon Aug 31:08:46:31Aug20> vi Point1.java SERVER:Mon Aug 31:08:48:31Aug20> vi index.php SERVER:Mon Aug 31:08:51:31Aug20> vi Point.java SERVER:Mon Aug 31:08:53:31Aug20> vi Point1.java SERVER:Mon Aug 31:08:55:31Aug20> javac Point1.java Point1.java:6: error: incompatible types: Point cannot be converted to Point1 ORIGIN = new Point(); ^ Point1.java:76: error: cannot find symbol System.out.println(Point.ORIGIN); ^ symbol: variable ORIGIN location: class Point 2 errors SERVER:Mon Aug 31:08:56:31Aug20> !vi vi Point1.java SERVER:Mon Aug 31:08:56:31Aug20> !j javac Point1.java Point1.java:6: error: incompatible types: Point cannot be converted to Point1 ORIGIN = new Point(); ^ 1 error SERVER:Mon Aug 31:08:56:31Aug20> !vi vi Point1.java SERVER:Mon Aug 31:08:56:31Aug20> !j javac Point1.java SERVER:Mon Aug 31:08:57:31Aug20> java Point Error: Could not find or load main class Point SERVER:Mon Aug 31:08:57:31Aug20> java Point1 (3, 4) (0, 0) 5.0 5.0 7 7 false true (0, 0) SERVER:Mon Aug 31:08:57:31Aug20> vi Naughty.java SERVER:Mon Aug 31:09:03:31Aug20> makeJava.py Naughy date=31, month = 8, year = 2020 SERVER:Mon Aug 31:09:03:31Aug20> vi Naughy.java SERVER:Mon Aug 31:09:05:31Aug20> javac Naughy.java Naughy.java:17: error: non-static variable x cannot be referenced from a static context System.out.println(x); ^ 1 error SERVER:Mon Aug 31:09:05:31Aug20> !vi vi Naughy.java SERVER:Mon Aug 31:09:06:31Aug20> javac Naughy.java SERVER:Mon Aug 31:09:07:31Aug20> java Naughy 42 SERVER:Mon Aug 31:09:07:31Aug20> !vi vi Naughy.java SERVER:Mon Aug 31:09:09:31Aug20> vi Minter.java SERVER:Mon Aug 31:09:09:31Aug20> makeJava.py Minter date=31, month = 8, year = 2020 SERVER:Mon Aug 31:09:09:31Aug20> ls Finality.class index.php Naughy.class Point1.class Point.java Finality.java Minter.java Naughy.java Point1.java SERVER:Mon Aug 31:09:09:31Aug20> vi Minter.java SERVER:Mon Aug 31:09:13:31Aug20> javac Minter.java SERVER:Mon Aug 31:09:13:31Aug20> java Minter Minter(1) Minter(2) Minter(3) Minter(4) Minter(5) Minter(6) Minter(7) Minter(8) Minter(9) Minter(10) SERVER:Mon Aug 31:09:13:31Aug20> !vi vi Minter.java SERVER:Mon Aug 31:09:16:31Aug20> !javac javac Minter.java Minter.java:37: error: cannot find symbol System.out.println(q.nextId()); ^ symbol: method nextId() location: variable q of type Minter 1 error SERVER:Mon Aug 31:09:16:31Aug20> !vi vi Minter.java SERVER:Mon Aug 31:09:16:31Aug20> !javac javac Minter.java SERVER:Mon Aug 31:09:16:31Aug20> java Minter Minter(1) Minter(2) Minter(3) Minter(4) Minter(5) Minter(6) Minter(7) Minter(8) Minter(9) Minter(10) 12 SERVER:Mon Aug 31:09:16:31Aug20> !vi vi Minter.java SERVER:Mon Aug 31:09:17:31Aug20> !javac javac Minter.java SERVER:Mon Aug 31:09:17:31Aug20> java Minter Minter(1) Minter(2) Minter(3) Minter(4) Minter(5) Minter(6) Minter(7) Minter(8) Minter(9) Minter(10) 11 SERVER:Mon Aug 31:09:18:31Aug20> SERVER:Mon Aug 31:09:26:31Aug20> exit logout Connection to utility0 closed. (base) MAC:Mon Aug 31:09:26:book> pwd /Users/morrison/book (base) MAC:Mon Aug 31:09:26:book> B (base) MAC:Mon Aug 31:09:26:4240> ls convert names.txt roster.txt students lab1 roster.csv stringPlay vpn.txt (base) MAC:Mon Aug 31:09:26:4240> mkdir week2 (base) MAC:Mon Aug 31:09:27:4240> cd week2/ (base) MAC:Mon Aug 31:09:27:week2> ls (base) MAC:Mon Aug 31:09:27:week2> F (base) MAC:Mon Aug 31:09:27:4240> A (base) MAC:Mon Aug 31:09:27:4260> lls -bash: lls: command not found (base) MAC:Mon Aug 31:09:27:4260> ls students week1 week2 (base) MAC:Mon Aug 31:09:27:4260> cd week2 (base) MAC:Mon Aug 31:09:27:week2> vi session.txt (base) MAC:Mon Aug 31:09:27:week2> B (base) MAC:Mon Aug 31:09:27:4240> cd week2 (base) MAC:Mon Aug 31:09:27:week2> ls (base) MAC:Mon Aug 31:09:27:week2> python Python 3.7.4 (default, Aug 13 2019, 15:17:50) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 3 + 4 7 >>> 3*4 12 >>> type(3) >>> 3/4 0.75 >>> type(3/4) >>> 3//4 0 >>> 365 % 7 1 >>> 3**4 81 >>> 3^4 7 >>> 3^5 6 >>> 3^6 5 >>> 2**1000 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376 >>> //integers: whole-number arithmetic File "", line 1 //integers: whole-number arithmetic ^ SyntaxError: invalid syntax >>> integers: whole-number arithmetic File "", line 1 integers: whole-number arithmetic ^ SyntaxError: invalid syntax >>> #integers: whole-number arithmetic ... >>> #floats: IEEE 754 64 bit floating point numbers ... >>> guac = 6.02e23 >>> print(guac) 6.02e+23 >>> .1 + .1 + .1 == .3 False >>> .1 + .1 + .1 0.30000000000000004 >>> type(False) >>> x = complex(3,4) >>> >>> x (3+4j) >>> # a cast is a temporary request to regard an object of one ... #type as being of another. ... >>> int(4.5) 4 >>> int(-4.5) -4 >>> ##cast a float to teh other types ... >>> boolean(4.5) Traceback (most recent call last): File "", line 1, in NameError: name 'boolean' is not defined >>> bool(4.5) True >>> complex(4.5) (4.5+0j) >>> complex(true) Traceback (most recent call last): File "", line 1, in NameError: name 'true' is not defined >>> complex(True) (1+0j) >>> float(True) 1.0 >>> float(False) 0.0 >>> x = complex(3,4) >>> int(x) Traceback (most recent call last): File "", line 1, in TypeError: can't convert complex to int >>> float(x) Traceback (most recent call last): File "", line 1, in TypeError: can't convert complex to float >>> x = 5+0j >>> type(x) >>> 6 > 7 or 5*5 == 25 True >>> True + True 2 >>> #arithmetic causes booleans to be cast to numbers ... >>> ## int, bool, float, complex ... >>> (base) MAC:Mon Aug 31:10:10:week2> !p python Python 3.7.4 (default, Aug 13 2019, 15:17:50) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information. >>> x = 5 >>> y = 2 >>> dir() ['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'x', 'y'] >>> x*y 10 >>> x**y 25 >>> x = 5.0 >>> #variables are typeless names ... >>> #veriable is a name ... >>> ##variables point at object ... >>> foo = "quagmire" >>> type(foo) >>> goo = "mire" >>> foo + goo 'quagmiremire' >>> 5 + 6 11 >>> "hello" + " thar" 'hello thar' >>> ## type determines context ... >>> "hello" + 5 Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate str (not "int") to str >>>