marking4/output
author Christian Urban <christian.urban@kcl.ac.uk>
Wed, 02 Nov 2022 21:49:42 +0000
changeset 430 274c865b3878
parent 300 72688efdf17c
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     2
postfix.scala does not contain vars, returns, Arrays, ListBuffers etc?
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     3
  --> success
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     4
postfix.scala runs?
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
  --> success
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     6
 syard(split("3 + 4 * ( 2 - 1 )")) == List("3", "4", "2", "1", "-", "*", "+")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     7
 syard(split("( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )")) == List("3", "4", "5", "+", "+")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     8
 syard(split("5 + 7 / 2")) == List("5", "7", "2", "/", "+")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
     9
 syard(split("5 * 7 / 2")) == List("5", "7", "*", "2", "/")
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  --> success
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    11
 compute(syard(split("3 + 4 * ( 2 - 1 )"))) == 7
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    12
 compute(syard(split("10 + 12 * 33"))) == 406
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    13
 compute(syard(split("( 5 + 7 ) * 2"))) == 24
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    14
 compute(syard(split("5 + 7 / 2"))) == 8
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    15
 compute(syard(split("5 * 7 / 2"))) == 17
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    16
 compute(syard(split("9 + 24 / ( 7 - 3 )"))) == 15
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    17
  --> success
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    18
postfix2.scala does not contain vars, returns, Arrays, ListBuffers etc?
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    19
  --> success
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    20
postfix2.scala runs?
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  --> success
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    22
 syard(split("3 + 4 * ( 2 - 1 )")) == List("3", "4", "2", "1", "-", "*", "+")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    23
 syard(split("( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )")) == List("3", "4", "5", "+", "+")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    24
 syard(split("5 + 7 / 2")) == List("5", "7", "2", "/", "+")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    25
 syard(split("5 * 7 / 2")) == List("5", "7", "*", "2", "/")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    26
 syard(split("3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3")) == 
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    27
         List("3", "4", "8", "*", "5", "1", "-", "2", "3", "^", "^", "/", "+")
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    28
 
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    29
 compute(syard(split("3 + 4 * ( 2 - 1 )"))) == 7
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    30
 compute(syard(split("10 + 12 * 33"))) == 406
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    31
 compute(syard(split("( 5 + 7 ) * 2"))) == 24
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    32
 compute(syard(split("5 + 7 / 2"))) == 8
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    33
 compute(syard(split("5 * 7 / 2"))) == 17
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    34
 compute(syard(split("9 + 24 / ( 7 - 3 )"))) == 15
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    35
 compute(syard(split("4 ^ 3 ^ 2"))) == 262144
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    36
 compute(syard(split("4 ^ ( 3 ^ 2 )"))) == 262144
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    37
 compute(syard(split("( 4 ^ 3 ) ^ 2"))) == 4096
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    38
 compute(syard(split("( 3 + 1 ) ^ 2 ^ 3"))) == 65536
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  --> success
300
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    40
Overall mark for CW 9, Preliminary Part
72688efdf17c updated testing files
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    41
4