CIS 351

Lab 1: Number Conversions

Fall 2018

Overview

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

Activities

Practice Problems

Write and solve 10 (or more) different number conversion problems.

Submit a document showing your problem, your work, and your solution.

Practice Problems

Use the provided Java starter code to 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:

The provided starter code contains a class in the default package named NumberBase with the method public static String convert(String input, int base_in, int base_out). This method takes the number represented by the input and converts it from base_in to base_out. For example, NumberBase.convert('ff',16,10) returns "255".

Assumptions:

Files:

Testing: I will use a JUnit test similar to NumberBaseTest_Sample.java to test your code. Be sure to thoroughly test your code using JUnit or other automated test framework. (The sample JUnit test is designed to ensure you named your classes and methods properly. It is up to you to extend it to thoroughly test your code.)

The test will not run unless you follow the directions above. If a class or method name is misspelled, the method signature (arguments, return value) changed, or visibility of the class and method are changed, the tests will not run and I will deduct points.

You may write, compile, and run your code using any IDE you prefer. However, there is a good chance I won't be able to help you if you have configuration problems. I will run and test your code from the EOS command line using commands similar to these:

(I'm a command line nerd; so, I'm happy to explain how/why these commands work.)

Submission and Grading:


W3c Validation