This preview shows page 1. Sign up to view the full content.
Unformatted text preview: binary number from the keyboard as a string and then convert it into decimal . For example, if the input is 1100, the output should be 12. Break the string into substrings (using the String.substring method). Convert each substring to an int value for a single bit (using the Integer.parseInt method). If the bits are b , b 1 , b 2 , and b 3 , the decimal equivalent is 8b + 4b 1 + 2b 2 + b 3 . Use constants for 8, 4, and 2. Create your program using Eclipse. Your project should be named Lab3 , and your Java class should be named Lab3 . Use the Scanner class to get input from the user, and use System.out to print to the console window. Make sure to comment your code, especially the two parts. Grading - 15 points total 5 points: Vending Machine 5 points: Binary to Decimal Conversion 5 points: Comments, style, and proper submission...
View Full Document
- Spring '08