Results 1 to 2 of 2
Thread: CRC check program 1 error
- 03-19-2008, 04:24 AM #1
Member
- Join Date
- Nov 2007
- Posts
- 2
- Rep Power
- 0
CRC check program 1 error
i'm trying to make a CRC calculator in Java and for some reason i'm having and issue with the "%" operator when trying to get a remainder. Any help would be greatly appreciated:
Java Code:/*Programmer: Your Name Here Date: July 30, 2007 Class: ITCS 3160 Professor: Cloyd Goodrum Program name: CRC.java Description: Write a program to read in a 16 bit string and a 4 bit generator polynomial. */ import javax.swing.JOptionPane; public class CRC { public static void main (String[] args) { int Orig; int Gen; int CRC; String original = JOptionPane.showInputDialog ("Please enter the binary message to be sent."); String generator = JOptionPane.showInputDialog ("Please enter the 4-bit binary generator."); Orig = Integer.parseInt (original,2); String OrigBinary = Integer.toBinaryString(Orig); System.out.println("Original Message: " + OrigBinary); Gen = Integer.parseInt (original,2); String GenBinary = Integer.toBinaryString(Gen); System.out.println("Generator: " + GenBinary); CRC = OrigBinary % GenBinary; System.out.println("CRC remainder: " + CRC); } }
- 03-19-2008, 05:04 AM #2
Similar Threads
-
Error: Could Not Find Main Class. Program Will Exit
By silvia in forum New To JavaReplies: 2Last Post: 09-22-2011, 09:48 PM -
spell check
By kazitula in forum Java AppletsReplies: 2Last Post: 12-20-2007, 11:37 AM -
how to check available resources in java program
By lealea in forum New To JavaReplies: 3Last Post: 08-13-2007, 08:35 PM -
Error: Cannot delete a.txt:It is being used by another person or program
By trill in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 07:34 AM -
Error :Invalid path, C:\Program Files\Java\j2re1.4.2_06\bin\javac.exe
By silvia in forum New To JavaReplies: 2Last Post: 07-30-2007, 08:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks