Hi
This spring I'm taking a Java coures and I need some help if posseble.
I have this assignment and he needs me to use the modulus in the code:
Q:Your application should read a four-digit integer entered by the user in an input dialog and encrypt it as follows: Replace each digit by (the sum of that digit plus 7) modulus 10. The swap the first digit with the third, and swap the second digit with the fourth. Then print the encrypted integer. Write a separate application that inputs an encrypted four-digit integer and decrypts it to form the original number.
This is what I came up with:
-----------------------------------------------------------
public class Assignment1 {
public static void main(String[] args){
int i = 10;
int j = 3;
System.out.prin tln("i is " + i);
System.out.prin tln("j is " + j);
int k = i % j;
System.out.prin tln("i%j is " + k)
}
}
but these code not fix with what the question ask.
This spring I'm taking a Java coures and I need some help if posseble.
I have this assignment and he needs me to use the modulus in the code:
Q:Your application should read a four-digit integer entered by the user in an input dialog and encrypt it as follows: Replace each digit by (the sum of that digit plus 7) modulus 10. The swap the first digit with the third, and swap the second digit with the fourth. Then print the encrypted integer. Write a separate application that inputs an encrypted four-digit integer and decrypts it to form the original number.
This is what I came up with:
-----------------------------------------------------------
public class Assignment1 {
public static void main(String[] args){
int i = 10;
int j = 3;
System.out.prin tln("i is " + i);
System.out.prin tln("j is " + j);
int k = i % j;
System.out.prin tln("i%j is " + k)
}
}
but these code not fix with what the question ask.
Comment