Have a challenge (at least to me) for a challenger

i got a new screenname so i could give away the 25 dukes to whoever does it, not too sure if its much of an incentive. out of the past 48 hours i have been up about 40 of those hours, and i am so burned out on java right now i dont care about the stupid bet i did this for, but i know i do (know what i mean?!). anyway, i thought i'd let some very gracious and smart person(s) to help out a not-so-good rookie java programmer. i have already received help, and could always use more!! so, i have the first part of this program finished. all i need left to do is decrypt it. the instructions that were given to me are below (the decryption is the reverse of the instructions). the code i have is below that. i have case 1 finished, i just need the method for case 2. i appreciate whoever helps me out, it will be returned. thank u!!!! now im going to bed.
1. Swap digits 1 and 7, 2 and 6, and 3 and 5 of the original number
2. Using the output of phase 1, replace each digit with the sum of that digit plus 9 modulo 10
3. Using the output of phase 2, swap digits 1 and 2, 3 and 4, and 5 and 6
import javax.swing.*;
public class Program3{
public static int array;
public static void main( String args [ ] )
String num, num1, num2;
int number, number1, number2;
num = showMenu ( );
number = Integer.parseInt( num );
if( number < 4 )
switch ( number ){        
case 1:
num1 = JOptionPane.showInputDialog("Please enter a seven digit number : ");
number1 = Integer.parseInt( num1 );
swapDigit( num1 );
break;
case 2:
num2 = JOptionPane.showInputDialog("Enter an encrypted number : ");
number2 = Integer.parseInt( num2 );
break;
case 3:
System.exit ( 0 );
else
JOptionPane.showMessageDialog(null, "Enter another number. Choose ONLY numbers 1, 2, or 3 !!! GOT IT!!!\nGood, now let's try this again Einstein.", "HEY!!!!", JOptionPane.INFORMATION_MESSAGE);
showMenu ( );
public static String showMenu ( )
return JOptionPane.showInputDialog("Please enter the number corresponding to your choice : \n\n1. Encryption\n2. Decryption\n3. Exit\n");
public static void swapDigit ( String num1 )
int nums[ ] = new int[7];
char[ ] c = num1.toCharArray( );
int digit = 0;
for ( int k = 6; k >= 0; k--) {
nums [ digit++ ] = (Integer.parseInt (String.valueOf (c [ k ] )) + 9) % 10;
StringBuffer finaloutput = new StringBuffer( );
finaloutput.append( nums [1]);
finaloutput.append( nums [0]);
finaloutput.append(nums [3]);
finaloutput.append(nums [2]);
finaloutput.append(nums [5]);
finaloutput.append(nums [4]);
finaloutput.append(nums [6]);
array = Integer.parseInt( finaloutput.toString());
JOptionPane.showMessageDialog( null, finaloutput, "encrypted number", JOptionPane.INFORMATION_MESSAGE);

This site has problem with the posting of code...here is an unformatted version:
import javax.swing.*;
public class Program3 {
   public static int array;
   public static void main( String args [ ] ) {
      String num, num1, num2;
      int number=0;
      boolean repeat=true;
      while (repeat) {
      num = showMenu ();
      number = Integer.parseInt( num );
      if (number < 4 ) {
         switch (number ) {
            case 1:
               num1 = JOptionPane.showInputDialog("Please enter a seven digit number : ");
               num1=step1(num1);
               num1=step2(num1);
               num1=step3(num1);
               JOptionPane.showMessageDialog( null, num1, "encrypted number", JOptionPane.INFORMATION_MESSAGE);
               break;
            case 2:
               num2 = JOptionPane.showInputDialog("Enter an encrypted number : ");
               num2=step3(num2);
               num2=step2r(num2);
               num2=step1(num2);
               JOptionPane.showMessageDialog( null, num2, "decrypted number", JOptionPane.INFORMATION_MESSAGE);
               break;
            case 3:
               repeat=false;
               break;
      } else JOptionPane.showMessageDialog(null, "Enter another number. Choose ONLY numbers 1, 2, or 3 !!! GOT IT!!!\nGood, now let's try this again Einstein.","HEY!!!!",
           JOptionPane.INFORMATION_MESSAGE);
      System.exit (0 );
   public static String showMenu () {
      return JOptionPane.showInputDialog("Please enter the number corresponding to your choice : \n\n1. Encryption\n2. Decryption\n3. Exit\n");
   public static String step1(String num1) {
      String ret="";
      for (int i=6;i>=0;i--) ret+=num1.charAt(i);
      return ret;
   public static String step2(String num1) {
      String ret="";
      for (int i=0;i<7;i++) ret+=((num1.charAt(i)-'0') + 9) % 10;
      return ret;
   public static String step2r(String num1) {
      String ret="";
      for (int i=0;i<7;i++) ret+=((num1.charAt(i)-'0') + 10) % 9;
      return ret;
   public static String step3(String num1) {
      String ret="";
      ret+=num1.charAt(1);
      ret+=num1.charAt(0);
      ret+=num1.charAt(3);
      ret+=num1.charAt(2);
      ret+=num1.charAt(5);
      ret+=num1.charAt(4);
      ret+=num1.charAt(6);
      return ret;
}Better?
V.V.

Similar Messages

  • I  spend good money for my iPhone i have the iPhone 5 with the new charger slot which is smaller. I have been through at least 3 charging cords and this is not acceptable to me. i never had a problem with this on my older phone. apple needs to correct tho

    I  spend good money for my iPhone i have the iPhone 5 with the new charger slot which is smaller. I have been through at least 3 charging cords and this is not acceptable to me. i never had a problem with this on my older phone. apple needs to correct this and reimburse me for this cord.

    Charging cords are covered by the iPhone warranty or their own warranty
    if puchased separately. Take your iPhone and the cords to your local
    Apple store for evaluation and possible replacement.

  • HT5085 I have found that at least 3 music videos that I had previously purchased are not available in my I-tunes music video list.  I paid for them over a year ago, why are they not accessible, and why did they just disappear from my lists?

    I have found that at least 3 music videos that I had previously purchased are not available in my I-tunes music video list.  I paid for them over a year ago, why are they not accessible, and why did they just disappear from my lists?

    Have you deleted anything from your iTunes library ? Have you checked to see if they are still on your computer, but not listed in your iTunes library ?
    If not then do they show in the Purchased link under Quicklinks on the right-hand side of the iTunes store homepage for redownloading ? If they don't show there and others do and they are still in your country's store, then check to see if they are hidden : http://support.apple.com/kb/HT4919
    If they are no longer in your store for redownloading (or you aren't in a country where music videos can be redownloaded) then you will need to copy them back from your backup of your library/downloads.

  • I have had an iPod Touch 3rd Gen for two years and the apps have worked fine in the past. Suddenly the apps will not launch, they appear to start then just exit. Is there a reason why it is doing this?

     I have had an iPod Touch 3rd Gen for two years pretty much and the apps have worked fine. Suddenly when I go on an app it appears to launch then just exits. I tried turning the iPod off and on again, but that made all my apps behave like that. Settings and those things work fine still. Should this suddenly happen? I dont want to lose all 204 apps.

    - First try resetting the iPod. Nothing will be lost.
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Next try downloading/installing a new app
    - Restore from backup
    - Last, resore to factory defaults/new iPod.  this is last result since you will lose app data.

  • HT204150 How do I change my default email on the "Me" contact from a Facebook email to my normal email address in the same contact?  Or at least change it for the autofill information?

    How do I change my default email on the "Me" contact from a Facebook email to my normal email address in the same contact?  Or at least change it for the autofill information?
    Perfernece for contact to change.  Do I just have to dis-associate my contact fromt the facebook account?  Is only the autofill changable?

    If you allow Facebook to access your contacts and you have the @facebook.com email alias turned on, it will add the @facebook.com email to your contact info, and because it has the fixed label of "email" it overrides every other email address.
    They didn't fix this in iOS 8.
    There are two ways to remove the @facebook.com email from your contact info:
    If you don't need your Facebook friends and their info updating your contacts, go into iOS Settings -> Facebook and turn off access to Contacts.
    If you don't use your @facebook.com email address (all it does it forward to the primary email address) you can go into the Facebook app, More -> Settings -> General -> Email -> and uncheck "Use your Facebook email". Removing it from Account Emails does not work, you have to turn it off. Once you do this, go to iOS Settings -> Facebook and turn Contacts off and on again to make it update your info. The @facebook.com address should be removed.

  • I was looking at the "Find my iPhone" app and I have a doubt regarding how it works for the macbook. In order to detect the location, the macbook should remain signed into iCloud. What if the thief logs out of iCloud. Would we able to locate the macbook?

    I was looking at the "Find my iPhone" app and I have a doubt regarding how it works for the macbook. In order to detect the location, the macbook should remain signed into iCloud. What if the person who has stolen my macbook logs out of iCloud.
    It should work fine for iPhone/iPad because we can enable "Restrictions" to prevent the user from signing out of iCloud. Do we have simialr settings for the macbook?
    Thanks,

    If it's not on the device list, it indicates that someone has gone to Find My iPhone on icloud.com and manually deleted it from the device list (as explained here: http://help.apple.com/icloud/#mmfc0eeddd), and it has not gone back online since (which would cause it to reappear on the device list; Find My iPhone has been turned of in settings on the device; the iClolud account has been deleted from the device; or the entire devices has been erased and restored.
    Unfortunately, there's no other way to track the phone other than through Find My iPhone.  You could call your carrier and see if they would blackliste it so at least the theif couldn't use it.

  • 1. I have an iPod which has purchases synced with I tunes with an apple ID. I now have an iPad with a new ID for cloud. I have cloud storage capacity of 5gb which came with the iPad. How can I use one ID and store my existing music in cloud?

    1. I have an iPod which has purchases synced with I tunes with an apple ID. I now have an iPad with a new ID for cloud. I have cloud storage capacity of 5gb which came with the iPad. How can I use one ID and store my existing music in cloud?

    HI Frostyfrog
    CHeck out iTunes Match which has an annual fee of £21 or thereabouts. You can store a maximum of 25,000 songs there and they all become available on your other kit, iPhone, iPad and iPod. I know it works as I have over 23000 songs uploaded of which only a few we're bought through iTunes.
    it works by comparing your music to the whole iTunes music dadata base so you access the same tunes that you could get from iTunes. If you have obscure stuff, it uploads your own music to the cloud as a copy.
    I Find it incredible that on my iPhone with its 16gb memory I can view almost 200 gb of music (ie my 23000 songs) and play any of them. Anything I add to iTunes becomes available via the cloud fairly quickly from a few minutes or a little longer if adding a lot.
    The first time you use it it will take quite a while to match your music if you have a lot, but after that it is all automatic. Read the stuff on the apple site. Your PC needs to be at least running Vista. I recommend it and at less than 50p a week it's good value.
    Good luck

  • I am paying for CC but when I try to access LR  it says I need to use serial number which I don't have  have been using PS on same account for a while.  Tried adobe support but got cut off.  While online with them they said I didn't need serial number

    I paid for CC and have been using PS.  However, I can't get to LR.  It says I need a serial Number.  I contacted Adobe and they said that is not the case.  Then I got cut off.  Any fix?

    If you paid for CC-full-suite or CC-Photography-Plan then you should have a CC-licensed version of LR available, but only if you uninstall the serial-number-licensed LR you apparently have, now.   At least try that, uninstall LR 5, log out of the CC app using Gear / Preferences / Account / Sign-Out, reboot, log back into the CC app, and see if LR is one of the items listed.

  • HT201386 Since the 8.02 update I now have every photo separated into an event for each pic. how do i get it back to the way it was before the update?

    I backed up my phone and then updated to the new update 8.02. I now have my pics in a separate album for each pic with an event attached to each one. how do i set it back up to the couple albums i had previously without adding all my pics from my computer which i dont want?

    You have 10.6 on that machine, I suggest you stick with it for performance, third party hardware and software reasons as long as possible.
    Consider 10.8 (not 10.7) when it's released, because 10.7 and 10.8 will require a new investment in software and newer third party hardware as it requires newer drivers the old machines won't have. (forced upgrade because of software, really nice of them)
    http://roaringapps.com/apps:table
    Far as your Safari problem do these things until it's resolved:
    1: Software Update fully under the Apple menu.
    2: Check the status of your plug-ins and update (works for all browsers) also install Firefox and see if your problems continue. You should always have at least two browsers on the machine just in case one fails.
    https://www.mozilla.org/en-US/plugincheck/
    Flash install instructions/problem resolution here if you need it.
    How to install Flash, fix problems
    3: Install Safari again from Apple's web site
    https://www.apple.com/safari/
    4: Run through this list of fixes, stopping with #16 and report back before doing #17
    Step by Step to fix your Mac

  • In Bdc I have huge volume of data to upload for the given transaction

    Hi gurus,
    In Bdc I have huge volume of data to upload for the given transaction, here am using session method, it takes lots of exection time to complete the whole transaction, Is there any other method to process the huge volume with minimum time,
    reward awaiting
    with regards
    Thambe

    Selection of BDC Method depends on the type of the requirement you have. But you can decide which one will suite requirement basing the difference between the two methods. The following are the differences between Session & Call Transaction.
    Session method.
    1) synchronous processing.
    2) can tranfer large amount of data.
    3) processing is slower.
    4) error log is created
    5) data is not updated until session is processed.
    Call transaction.
    1) asynchronous processing
    2) can transfer small amount of data
    3) processing is faster.
    4) errors need to be handled explicitly
    5) data is updated automatically
    Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is
    not bi-directional.
    BDC works on the principle of simulating user input for transactional screen, via an ABAP program.
    Typically the input comes in the form of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The transaction is then started using this internal table as the input and executed in the background.
    In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling. It can also be used for real-time interfaces and custom error handling & logging features. Whereas in
    Batch Input Sessions, the ABAP program creates a session with all the transactional data, and this session can be viewed, scheduled and processed (using Transaction SM35) at a later time. The latter technique has a built-in error processing mechanism too.
    Batch Input (BI) programs still use the classical BDC approach but doesn’t require an ABAP program to be written to format the BDCDATA. The user has to format the data using predefined structures and store it in a flat file. The BI program then reads this and invokes the transaction mentioned in the header record of the file.
    Direct Input (DI) programs work exactly similar to BI programs. But the only difference is, instead of processing screens they validate fields and directly load the data into tables using standard function modules. For this reason, DI programs are much faster (RMDATIND - Material Master DI program works at least 5 times faster) than the BDC counterpart and so ideally suited for loading large volume data. DI programs are not available for all application areas.
    synchronous & Asynchronous updating:
    http://www.icesoft.com/developer_guides/icefaces/htmlguide/devguide/keyConcepts4.html
    synchronous & Asynchronous processings
    Asynchronous refers to processes that do not depend on each other's outcome, and can therefore occur on different threads simultaneously. The opposite is synchronous. Synchronous processes wait for one to complete before the next begins. For those Group Policy settings for which both types of processes are available as options, you choose between the faster asynchronous or the safer, more predictable synchronous processing.
    By default, the processing of Group Policy is synchronous. Computer policy is completed before the CTRLALTDEL dialog box is presented, and user policy is completed before the shell is active and available for the user to interact with it.
    Note
    You can change this default behavior by using a policy setting for each so that processing is asynchronous. This is not recommended unless there are compelling performance reasons. To provide the most reliable operation, leave the processing as synchronous.

  • Since I installed Firefox 17.0.1, the program has become unstable. I have a hard time getting the program to respond to start. I have to try at least 3 times

    As I mentioned, the program will not start on the first time that I click the icon. The hourglass appears for a second or two and then disappears.
    I have to try at least 3 or more times before the program responds.
    Should I try to uninstall 17 and reinstall 16.
    I have already uninstalled 17 and reinstalled it.

    A possible cause is security software (firewall,anti-virus) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls
    Create a new profile as a test to check if your current profile is causing the problems.
    See "Creating a profile":
    *https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
    If the new profile works then you can transfer some files from an existing profile to the new profile, but be careful not to copy corrupted files.
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • I've exported a pdf document created in 2009 at least 20 times for a doc or docx version. Gibberish.

    I've exported a pdf document created in 2009 at least 20 times for a doc or docx version. Gibberish.

    Hi,
    Please open your PDF file in Adobe Reader then check the producer from File menu>Properties then let me know.I have seen the same issue with PDF file created by some producers.
    Or you can send me your PDF file so that I can look at it.
    Please use below site to share your file.
    https://adobeformscentral.com/?f=qJiclooYWGGNFtWfj8g3wg#
    Thank you.
    Hisami

  • IPhone 3GS - Have been trying to download OS 4 for a week !!!

    I'm using iTunes 9.2 which appears to be working fine ... already reinstalled it twice in case this was the issue ... I plug my iPhone 3GS in and request update to OS 4 ... update runs downloading 378 MB over a 29 minute period ... iPhone still attached ... timer finishes with 377.9 MB showing as being downloaded ... hangs for 30 seconds then informs me that connection has timed out and for me to start again ... I have been trying at least 6 times a day since last Sunday with no luck ... can somebody please advise what's going off ... already tried another PC and contacted my IP provider ?????

    You may want to wait until Apple fixes some bugs. My 3GS no longer syncs with MobileMe since installing iOS4. I spent a total of 7 hours over the past two days following all of the suggestions posted on the troubleshooting sites...to no avail. I even did a restore in iTunes and spent over two hours with a chat agent who also had no fix. He is "escalating" my issue to higher powers. I love the other features...folders, the ability to change backgrounds...but I have to be able to sync my calendars.

  • Player Error: "You cannot record without enabling at least one track for recording"

    So I'm trying to adjust my audio using the track mixer in premiere pro cc. I assigned 2 clips to a submix. When I tried to record, I got the following error: "You cannot record without enabling at least one track for recording." I disabled other tracks, then re enabled them all, muted them all, but still got the same error when I tried to record.

    This is how I have just made a recording:
    Select track to record (1), Select record (2) then press play to record.
    Use the in-out markers in the program monitor to select the area to record.

  • The window buttons (minimize, restore, close) don't operate, i have to minimize/restore from the taskbar for them to restore operation

    I explained the behaviour in the headline question. There is a thread about this, but it doesn't have the solution, and has been reported for FF13.
    This is FireFox 19, so it's been buggy, this is the 3rd support question I'm posting in the last two days. I've never done this before, but once, so it's not like I'm Mozilla Support fanboy, it's just that there are UI bugs that I have to deal each day, and there weren't these bugs before in earlier versions of FireFox.
    There's something wrong going on, I hope you fix this and offer a quick update, because however much love I have for the FireFox it's just not working. I'm not gonna switch browsers soon, but with these UI bugs I'm bound to do it, if it doesn't get fixed.

    I don't have ANY addons/extensions installed.
    I see that I will have to completely reinstall Firefox from the ground up, but I'll have to reconsider updating policy, maybe not allow automatic updates.
    This is not the first time an update has caused FireFox to stop functioning properly. And these UI bugs are really annoying, I mean window buttons not working? Lauch application dialog behaving as if it's in the background? And i didn't even mention that scrolling in the drop down lists isnt working also, cos I see there is no help for these bugs on this support forum, no matter how hard ppl are trying.
    Thanks for all the advices though, at least you took your time and tried to help. I think there's no cure but reinstalling completely and I hate when I have to do it, with no error on my part.

  • I download radio programmes via Podcast, but have recently found that some episodes play for only 30 seconds and then the whole app quits. This happens even though the whole episode has downloaded. I would be grateful for advice.

    I  download radio programmes via Podcast, but have recently found that some episodes play for only 30 seconds and then the whole app quits. This happens even though the whole episode has downloaded. I would be grateful for advice.

    Try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Delete the problem episodes  and redownload.
    - Reset all settings                            
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       

Maybe you are looking for

  • XML to flat file conversion using file content conversion in reciever CC

    Hi, Iam working on Idoc to File scenario. Iam having a problem in the communication channel of reciever. Iam using File content conversion in Reciever Adapter. My xml format is asfollows:-- - <Header>   <FILLER1>KTP</FILLER1>   <YEAR_IDOC>YEAR 2006</

  • Need help: question about itunes update problem

    I started up iTunes yesterday and a window popped up saying there was a new version of iTunes to update, so I did it, and now I can't save equalizer presets! The feature doesn't work at all anymore, and it used to work great. It just goes back to Man

  • Problem setting up hp network printers on OS X 10.5.4

    Hardware setup: MBP to Airport to Linksys switch. HP Laserjet and Designjet to Linksys switch. Problem: OS X does not automatically recognize printers. Manual input of IP addresses results in seemingly set up printer, but unable to complete print job

  • Vision: M Wont' Connect To

    So, I've had various problems with it at the moment. I used to automatically get album art just by dragging and dropping into the area but now, after much hassle with Windows Media Player and different versions, I've managed to get albuma art by tran

  • Statspack Total Wait time

    hi - using v 9.2 I'm wondering about the Total Wait Time (s) in the Top 5 wait Events list. I took a snapshot for 10.55(min) but some of the Time (s) exceeds this, so i'm clearly interpreting something incorrectly: Top 5 Timed Events ~~~~~~~~~~~~~~~~