Challenge Lab 1! Solution

$30.00

Description

Lab description. Converting numbers to different bases.

In this activity, you will design a method called Conversion whose aim is to practice the conversion of numbers from one given base to another base.

Method Conversion takes the following inputs:

  • The number the user plans to convert;
  • The original base (an integer); and
  • The target base (an integer);

And it returns the number, given in the original base, now translated in the target base.

Note: the base numbers can be anything between 2 and 36.

Examples:

Conversion(111,2,10) 7

Conversion(31,10,2) 11111

Conversion(A3,16,10) 163

Conversion(1A,16,2) 11010

Conversion(27,10,16) 1B

Important note: When manipulating the number given as an input, you are not allowed to use built-in functions from Java, outside of length() (for Strings), possibly charAt() (for Strings), power function, floor/ceiling.

What you have to turn in:

  • A docx file in which you describe the pseudocode of the above conversion method, along with a set of test cases designed to challenge your implementation and ensure that it works properly (i.e., as expected).
  • A single java file that contains the conversion method as well as a main file.

Important notes:

  • Indent your code properly following guidelines available at: http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-136091.html. 15% of your grade will be reserved for correct indentation. Failing to indent properly puts you at risk of losing 15%.
  • Spend time working on your pseudocode as pseudocode weighs 50% of the grade on this lab.
  • Spend time designing your test cases as the quality of your test cases weighs 20% of the grade on this lab.
  • Do not write your methods inside the main method. Each method has to be written where instructed in the code provided to you. Failing to do so puts you at risk of losing 20% off your lab grade.
  • Do not submit more than the files that are requested from you: one docx file and one java file.

That’s it! Looking forward to seeing you in lab!


error: Content is protected !!