Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having some trouble getting the output text on the jtextfield. The code works in the output but when I press the Decrypt jButton on

image text in transcribed

image text in transcribed

image text in transcribed

I'm having some trouble getting the output text on the jtextfield. The code works in the output but when I press the Decrypt jButton on the GUI its sending a bunch of errors

image text in transcribed

image text in transcribed

image text in transcribed

need help with a code to get the decrypt button to get the output cipher text

image text in transcribed

public String Decrypt(String key, String CT) 107 108 Transposition ob = new Transposition(); int d = CT. length() / key.length(); String Skey = ""; Skey = ob.GetSerial(key); 115 116 117 118 int c = key.length(); int r = CT.length() / c; int i = 0; char() Array = new char[r][c]; ava in.java t.java for (int i = 0; i Notifications Output Java Application 66 (run) Debugger Console Starti ormed (ActionEvent Formed(ActionEvent Formed actinnen run: BUILD SUCCESSFUL (total time: 0 seconds) Startl (run) runn int c = key.length(); int r = CT. length() / c; int i = 0; charu Array = new char[r] (c); for (int i = 0; i Notifications Output Java Application 66 (run) 3 Debugger Console > Starti armed (ActionEvent ormed(ActionEvent medartinent run: BUILD SUCCESSFUL (total time: 0 seconds) Startl (run) runni U Japaye Java E Caesar java X Source 317 318 319 Design History @ * @param args the command line arguments B */ public static void main(String args) { Scanner sc = new Scanner(System.in); System.out.println("Transposition "); Transposition ob = new Transposition(); System.out.println("Enter the Plain text : "); String PT = sc.nextLine(); System.out.println("Enter the key : "); String key = sc.nextLine(); String CT = "; System.out.println("Plain Text : " + PT); PT = ob. SpaceFree (PT); iva System.out.println("Space Free : " + PT); System.out.println(); CT = ob.Encrypt(key, PT); System.out.println("Cipher Text : " + CT); ob.Decrypt(key, CT); Look and feel sett 0 365 DO + atore key): String g PT): String A 366 /* Create and display the form */ 367 java.awt. EventQueue.invokela 368 new Transposition().setv 369 370 Previous Ne Find: Select start1.Transposition > Notifications Output JavaApplication 66 (run) Debugger Console run: BUILD SUCCESSFUL (total time: 0 String Start1 (run) ed(ActionEvent ed(ActionEvent odlarsinntuont Start 1 (run) running... package start1; import java.util.Arrays; import java.util.Scanner; public class Transposition extends javax.swing.JFrame { String SpaceFree(String PT) { String SFPT = ""; for (int i = 0; i Notifications Output Java Application 66 (run) % w Debugger Console Start1 .ctionEvent actionEvent rtiansen run: BUILD SUCCESSFUL (total time: 0 seconds) Start 1 (run) runni Startpage.java arce o I T T Caesar.java o Design History int i = 0, 1l = 0; char[Array = new char[r][c]; for (int i = 0; i Notifications Output railfence (run) #5 Debugger Console Start 1 Java Application 66 (run) run: BUILD SUCCESSFUL (total time: 0 seconds) running... Start 1 (run) conf... T8D-R 0.00 h sar.java x los Playfair.java X playfair 1.java * playfair1.java X Design History . . F System.out.print(key.charAt(i) + " "); Startpage.java T B System.out.println(); for (int i = 0; i Notifications Output W railfence (run) #5 Debugger Consol Java Application 66 (run) 8 run o l java | Caesar java playfair1.java Design playfair1.java History D Startpage java D E Transposition.java - Decrypt Plain Text: Key : Cipher Text : Decrypt Start Exit Reset Notifications Output Java Application 66 (run) Debugger Console Start1 (run) Start (run) run: BUILD SUCCESSFUL (total time: 0 seconds) Start 1 (run) running... public String Decrypt(String key, String CT) 107 108 Transposition ob = new Transposition(); int d = CT. length() / key.length(); String Skey = ""; Skey = ob.GetSerial(key); 115 116 117 118 int c = key.length(); int r = CT.length() / c; int i = 0; char() Array = new char[r][c]; ava in.java t.java for (int i = 0; i Notifications Output Java Application 66 (run) Debugger Console Starti ormed (ActionEvent Formed(ActionEvent Formed actinnen run: BUILD SUCCESSFUL (total time: 0 seconds) Startl (run) runn int c = key.length(); int r = CT. length() / c; int i = 0; charu Array = new char[r] (c); for (int i = 0; i Notifications Output Java Application 66 (run) 3 Debugger Console > Starti armed (ActionEvent ormed(ActionEvent medartinent run: BUILD SUCCESSFUL (total time: 0 seconds) Startl (run) runni U Japaye Java E Caesar java X Source 317 318 319 Design History @ * @param args the command line arguments B */ public static void main(String args) { Scanner sc = new Scanner(System.in); System.out.println("Transposition "); Transposition ob = new Transposition(); System.out.println("Enter the Plain text : "); String PT = sc.nextLine(); System.out.println("Enter the key : "); String key = sc.nextLine(); String CT = "; System.out.println("Plain Text : " + PT); PT = ob. SpaceFree (PT); iva System.out.println("Space Free : " + PT); System.out.println(); CT = ob.Encrypt(key, PT); System.out.println("Cipher Text : " + CT); ob.Decrypt(key, CT); Look and feel sett 0 365 DO + atore key): String g PT): String A 366 /* Create and display the form */ 367 java.awt. EventQueue.invokela 368 new Transposition().setv 369 370 Previous Ne Find: Select start1.Transposition > Notifications Output JavaApplication 66 (run) Debugger Console run: BUILD SUCCESSFUL (total time: 0 String Start1 (run) ed(ActionEvent ed(ActionEvent odlarsinntuont Start 1 (run) running... package start1; import java.util.Arrays; import java.util.Scanner; public class Transposition extends javax.swing.JFrame { String SpaceFree(String PT) { String SFPT = ""; for (int i = 0; i Notifications Output Java Application 66 (run) % w Debugger Console Start1 .ctionEvent actionEvent rtiansen run: BUILD SUCCESSFUL (total time: 0 seconds) Start 1 (run) runni Startpage.java arce o I T T Caesar.java o Design History int i = 0, 1l = 0; char[Array = new char[r][c]; for (int i = 0; i Notifications Output railfence (run) #5 Debugger Console Start 1 Java Application 66 (run) run: BUILD SUCCESSFUL (total time: 0 seconds) running... Start 1 (run) conf... T8D-R 0.00 h sar.java x los Playfair.java X playfair 1.java * playfair1.java X Design History . . F System.out.print(key.charAt(i) + " "); Startpage.java T B System.out.println(); for (int i = 0; i Notifications Output W railfence (run) #5 Debugger Consol Java Application 66 (run) 8 run o l java | Caesar java playfair1.java Design playfair1.java History D Startpage java D E Transposition.java - Decrypt Plain Text: Key : Cipher Text : Decrypt Start Exit Reset Notifications Output Java Application 66 (run) Debugger Console Start1 (run) Start (run) run: BUILD SUCCESSFUL (total time: 0 seconds) Start 1 (run) running

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions