Hi,
im all new to this i am doing a cryptography module and i have been given the following task.
Practical 2 NetBeans Workshop
We ask you to implement a little program which can
· verify ISBN code and
· generate the check number from a given 9 digits
Task 1: GUI two input text fields and one text area for printing messages, three buttons (verify, generate, and clear).
This will help you to recall what you already learnt about NetBeans.
Use the following lines to clear up text boxes:
jTextField1.setText("");
jTextField2.setText("");
jTextArea1.setText("");
Task 2: Write code to achieve the about two functions (i.e. verifying and generating ISBN code)
We need 10 integers, you can use array, but to make thinks simple, lets use 10 integers:
int d1,d2,d3, .d10;
To read input from the text field, use
String s;
s = jTextField1.getText();
The following line gets the first char in the string, and convert it to an integer
d1 = Integer.parseInt(String.valueOf(s.charAt(0)));
Remember the all ten digits d1,d2, , d10, must satisfy the following condition:
(d1+2*d2+3*d3+4*d4+5*d5+6*d6+7*d7+8*d8+9*d9+10*d10 ) mod 11 = 0
That is, the check number, d10, must satisfy the following condition:
d10 = (d1+2*d2+3*d3+4*d4+5*d5+6*d6+7*d7+8*d8+9*d9) mod 11
working
10*d10 = ( (d1+2*d2+3*d3+4*d4+5*d5+6*d6+7*d7+8*d8+9*d9) mod 11), that is,
(-10)*d10 = (d1+2*d2+3*d3+4*d4+5*d5+6*d6+7*d7+8*d8+9*d9) mod 11
because -10 mod 11 = 1 mod 11, so
d10 = (d1+2*d2+3*d3+4*d4+5*d5+6*d6+7*d7+8*d8+9*d9) mod 11
Note that, In Java, the mod operation is %.
Firstly, Im in Netbeans do i use a Main class, a normal class, a java interface class, or what...?
I dont really get what to do to be honest.