CIS 351

Number Conversions

Fall 2021

Overview

The purpose of this lab is to provide students an opportunity to work closely with algorithms for changing number bases.

Content Preparation

Environment Preparation

This week's lab is to write some Java code. The automated testing for this project uses JUnit 5 and Maven. Make sure you have a suitable environment set up. The easiest solution may be to use the School of Computing's EOS/Arch environment because they are already set up. This is now even easier because you can work in EOS/Arch directly through your browser at https://cislab.hpc.gvsu.edu/. No more x2Go! This page provides details on how connect to EOS/Arch through a web browser.

This video discusses the steps below in more detail.

  1. Follow this GitHubClassroom link to generate your personal repository for next week's lab.
  2. Clone the generated Git repository.
  3. Open the project in the IDE of your choice.
    • If you use IntelliJ, open it as a "maven" project. not an Eclipse project.
    • This knowledge base article explains how to configure Visual Studio Code in the EOS/Arch environment.
  4. Make sure you can run the JUnit tests. In VS Code, open BaseConverterStudentTest.java and look for the green arrows to the left of the code. (The first time you open the project, there may be a delay before they appear.)
  5. Change the return statement in BaseConverter::convert from return "" to return "0". Re-run the tests and verify that at least one test now passes.
  6. When you have at least one test passing, commit your changes. (You do this from the command line using git add .; git commit -m your_message_here; git push. It is also possible to commit through your IDE.)
  7. After pushing your code, visit your repository's web page and run the automated tests. (This video demonstrates how.)
    1. From your repository's page, click on the Actions tab.
    2. On the left, you should see a list labeled "Workflows". Below that will be "All Workflows", and below that will be "GitHub Classroom Workflow". Select "GitHub Classroom Workflow".
    3. Selecting "GitHub Classroom Workflow" should cause a banner to appear with a button labeled "Run Workflow" to the right. Open that dropdown menu and click the "Run workflow" button.
    4. There will be a pause of 10 seconds or so and you will see a yellow dot appear that indicates that your tests are in progress.

Activity

Write a conversion method that will take in a string representing a number in a specified base and convert it to another base. Do not worry so much about catching error conditions; for this lab it is more important to learn the number conversion process and implement the algorithm.

Restrictions:

Assumptions:

Testing:

I have provided a few sample JUnit tests in BaseConverterStudentTest.java. Add more of your own tests.

I have also written a larger suite of tests that I will use when grading your lab. These tests will run automatically when you push your code. If these tests fail, then you have two problems (1) a bug in your code, and (2) a missing test case (since your test suite didn't find the bug). If your code fails my tests, (1) find the missing test case, (2) fix the corresponding bug, then (3) push the fix. I won't grade your lab until it passes all my tests.

Submission and Grading:

Once your code passes my tests, push the code with the string [Grade Me] in the commit message.


Updated Tuesday, 7 September 2021, 10:02 AM

W3c Validation