binary converter

binary converter - ); String binary; binary =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; public class BinaryConverter { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner keyboard = new Scanner(System. in ); System. out .println( "Welcome to the Binary Converter!" ); System. out .println( "Please enter your name:" ); String userName; userName = keyboard.next(); System. out .println(userName + ", please enter a 4-bit binary number to convert:"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ); String binary; binary = keyboard.next(); String first = binary.substring(0,1); String second = binary.substring(1,2); String third = binary.substring(2,3); String fourth = binary.substring(3,4); System. out .println( "Converting. .." ); System. out .println(first); System. out .println(second); System. out .println(third); System. out .println(fourth);...
View Full Document

This note was uploaded on 09/19/2011 for the course CSCE 146 taught by Professor Allen during the Spring '11 term at South Carolina.

Ask a homework question - tutors are online