Top Topics in our Forum';
Interactive Parabola Grapher
Explore graph ,equation and the locus of a Parabola
Save graphs to your desktop!

A+    A−    B  
Algebra
Games
Geometry
Interactive
Trigonometry
Forum



Warning: include(/home/mathwa6/public_html/php_include/forum_left_side.php) [function.include]: failed to open stream: No such file or directory in /home/mathwa6/public_html/php_include/ontheLeft_moris.php on line 296

Warning: include() [function.include]: Failed opening '/home/mathwa6/public_html/php_include/forum_left_side.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mathwa6/public_html/php_include/ontheLeft_moris.php on line 296


AddThis Social Bookmark Button

Binary Calculator Project

Objective : To create a calculator that performs the four main operations on decimal input. However, this calculator should output the result in binary!

Note: If you want to make sure that your calculator works, feel free to check your results using this decimal binary calculator


Source File: Calculator.java
Requirements of the project:

Task #1) Create a class called DecimalToBinary

Requirements

A static overloaded method called toBinary();

Y our job is to fill in the body of the functions whose headers are written below. Note the last example returns an array of type long that are the binary equivalents of the double[] parameters.

//Pre condition for all methods: parameters are decimal

//Post condition for all methods: return types are binary

public static long toBinary( int x){ ; }

public static long toBinary( double x){ ; }

public static long toBinary( long x){ ; }

public static long toBinary( String x){ ; }

public static long[] toBinary( double[] x){ ; }

Note: Java, like most languages, has some built in support that do all of the conversions for you.(Integer.toBinaryString(myInt) is just one) Using any built in method like toBinaryString is not a legal way of completing this project since one of the goals is to become more proficient at and gain a deeper undestanding of converting numbers from one base to another. You must come up with your own algorithm that converts numbers from decimal to binary.