What to look at. The only references you may use for this lab are:

computer science


1. Instructions 

1.1. What to look at. The only references you may use for this lab are: 

• The scala notes on Canvas 

• The scala cheetsheat on Canvas 

• The scala textbook (Programming in Scala, any edition, details on Canvas) 

Why this restriction? Because otherwise, what students typically do is search online to find a blog or (stackoverflow post) written by someone who has no clue and who provides bad advice/examples. Surprisingly, just because something is on the internet, does not mean it is true, accurate, or a good way of doing things. 

1.2. How to collaborate. Remember: you cannot look at the code written by other students for this assignment. So how can you collaborate? Easy. There are two ways: 

• Discuss algorithms or general strategies (e.g., how you would explain something to an English major friend). 

• Create a similar problem (i.e. a problem that uses similar concepts) and work on the code together. Based on what you learn, then do the assigned problem. This is a good way to figure out a general strategy for solving the problem. This will also prevent your code from being extremely similar.

Stuck? Ask general questions on piazza.

1.3. Getting the code, compiling it. Download the files tester.scala and lab4.scala from Canvas. Put all of your code inside the Lab object in lab.scala. Remember, since scala uses the Java virtual machine, all of the code in each file has to reside inside an object or a class. To compile your code you can do either of the following: 

• From the linux shell (in the directory containing the code): sbt compile compiles the code and sbt run runs the code. 

• From the sbt shell (this is faster): compile compiles your code and run runs your code. Sometimes if you get strange errors, clean can help. It will remove temporary files to allow you to recompile from scratch.

Related Questions in computer science category