Lab18: Final round of CodingBat

ScoreUp screenshot

Part 1  - Coding Bat AP1

  1. Remember to log into CodingBat before doing any problems so you will receive credit. Only submit the Word of the Day via Canvas.
  2. See how many of the Recursion-1 problems you can solve today. At a minimum, solve the following: sumDigits, countX. Be sure to read the paragraph at the top of the Recursion-1 page. 
  3. Solve as many of the first 6 AP-1 problems (skip wordsWithoutList as this uses ArrayLists which we have not covered in class) problems as you can during the lab period. These problems are good practice for the logic/loop/array aspects of the exam.

You will receive two points for each problem solved (10 points max).

Part 2 - Eclipse Plugins (optional - Extra Credit)

One of the great advantages of using Eclipse is the rich third-party plugin library that exists. Plugins are developed and maintained by other users and organizations, and they are freely available. This next section will walk through setting up some of the plugins we use in CS 149 and CS 159.

Follow Lab 17 Part 3 Steps 1-3 to create a CodingBatAP1.java file with stubs for the AP1 problems from Coding Bat.  To help you out I've created a sample of this CodingBatAP1.java as a starter file you can copy and paste into your file.

JUnit

  1. Select File -> New -> Other -> Junit Test Case. Select "New JUnit 3 test" (that's what we've been using this semester) and name your class CodingBatAP1Test. Click Next, and select the six AP-1 methods to create stubs.
  2. To save you some busy work, copy the contents of this CodingBatAP1Test.java file into your new test file.
  3. To run JUnit tests, select Run -> RunAs -> JUnit Test. This will test your methods using CodingBatAP1Test.
  4. Finish writing test cases for your program. Get all six working 100% and submit to Web-CAT for extra credit.

Checkstyle

  1. Go to Help -> Eclipse marketplace, find the Checkstyle plugin, and click the Install button.
  2. Configure checkstyle to use our cs149.xml  from Lab 3 Style guide by going to Window -> Preferences -> Checkstyle and importing the cs149.xml as an External Configuration file. (Click New, select the Type, name it cs149, and Browse to the location of cs149.xml.)
  3. Go to the Package Explorer panel (on the left), right-click your project, and select Checkstyle -> Activate Checkstyle to get comments in your main code window. You will need to repeat this last step for each project in the future; it's not enabled by default.

Fomatter

When you press Ctrl+Shift+F to format your code, it uses the built-in style definitions. They don't match our Checkstyle configuration, but they are easy to customize.

  1. Go to Window -> Preferences -> Java -> CodeStyle -> Formatter, and then do an import of our CS149-formatter.xml  file. (We suggest you download this file to your workspace directory, so it's easy to find.)

EclEmma

  1. Go to Help -> Eclipse Marketplace, find EclEmma, and click Install. This plugin will allow you to run 'Code Coverage' tests (like Web-CAT does) against your program to see the coverage of your test files against your code.
  2. You can now run coverage tests against your program by clicking the Coverage button  on the toolbar, or by going to Run -> Coverage from the menu bar.

Take Home: 

  1. To install Eclipse on your Linux Mint Virtual machine follow these instructions: Go to
    http://www.eclipse.org/downloads/index.php to download the latest version of Eclipse(Neon)

  2. Make a directory in your Linux VM by running mkdir /home/user/eclipse-neon where user is your username

  3. extract the archive into this directory with archive manager
    or
    tar -zxvf file_name.tar.gz -C /home/user/eclipse-neon

  4. Run the eclipse-inst file by double clicking on it in your explore window.


Back to Top