Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Heres my code please fix the logical error when the user enters Not visible which is odd he should get elbisiv toN but he doesnt
Heres my code please fix the logical error when the user enters Not visible which is odd he should get elbisiv toN but he doesnt get the desired output please work on the code and follow the instructuon to make him get the correct outputWelcome to Concordia CSSE Drone Cipher Program:
Please enter your plain message below:
elbisiv toN
Kindly find below your cipher message output:
Not visible
Thank you for your contribution to Concordia CSSE Drone Cipher Project.
Figure Sample output of Question
Welcome to Concordia CSSE Drone Cipher Program:
Please enter your plain message below:
A big black object is moving!
Kindly find below your cipher message output:
gnivom si tcejbo kcalb gib A
Thank you for your contribution to Concordia CSSE Drone Cipher Project.
Figure Sample output of Question
Welcome to Concordia CSSE Drone Cipher Program:
Please enter your plain message below:
gnivom si tcejbo kcalb gib A
Kindly find below your cipher message output:
A big black object is moving!
Thank you for your contribution to Concordia CSSE Drone Cipher Project.
Figure Sample output of Question Assignment Written by: Mena Boulus For COMP Section UJX Winter import java.util.Scanner; Importing the Scanner class from java.util package for user inputpublic class AQ Declaring a public class named AQ public static void mainString args Scanner mena new ScannerSystemin; Creating a Scanner object for user input System.out.printlnWelcome to Concordia CSSE Drone Cipher Program:"; Printing a welcome message System.out.println; System.out.printlnPlease enter your plain message below:"; Prompting the user to enter a message String Encodeven ; Declaring an empty string variable for evenindexed characters String Encodeodd ; Declaring an empty string variable for oddindexed characters String Original mena.nextLine; Reading user input and storing it in a string variable Original.strip; Stripping to create whitespaces from the input if Originallength Checking if the length of the input string is even int x Original.length; Initializing a variable for loop iteration while x Original.length Looping through the evenindexed characters char y Original.charAtx; Getting the character at the current index Encodeven y; Assigning it to Encodeven string x; Decrementing the index else Executed if the length of the input string is odd int z Original.length; Initializing a variable for loop iteration while z Original.length Looping through the oddindexed characters char y Original.charAtz; Getting the character at the current index Encodeodd y; Assigning to the Encodeodd string z; Decrementing the index System.out.printlnEncodeodd; Printing the oddindexed characters if Originallength Checking if the length of the input string is even Encodeven Original.substring Original.length; Appending the first half of the input string to Encodeven System.out.println
Kindly find below your cipher message output:"; Printing a message System.out.printlnEncodeven; Printing the cipher message for evenlength input System.out.println
Thank you for your contribution to Concordia CSSE Drone Cipher Project."; Printing a thank you message mena.close; Closing the Scanner object to release system resources instructions:if the length is even the output should be the reversed first half and the isecond half if the lengthis odd the output should be the reversed of the second half after the middle charachter iithe middle charachter of original string iii the reverse of the first half of the original string before the middle charachter
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started