Results 1 to 5 of 5
  1. #1
    dwayneduy's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    64
    Reputation
    10
    Thanks
    1
    My Mood
    Crappy

    Need help with school work...

    Write a Java program to read in a line of text from keyboard. Then, act as follows (modifying the string each time):
    If the user enters “n” shift all letters in the string forward 1 (A -> B, B -> C, etc.) and print the result.
    If the user enters “p” shift all letters in the string backward 1 (A -> Z, B -> A, etc.) and print the result.
    If the user enters anything else, exit the program.
    I don't understand any of this, plz help me...
    Succeed trade: sadface197 (nice guy)
    Scamer: ProHackTB (becareful with his keylogged logic)
    MSN: dwaynedong@hotmail.com
    Haters gonna hate. So back off and say hi to my midfinger!

  2. #2
    ArnavKumar's Avatar
    Join Date
    Oct 2013
    Gender
    male
    Posts
    7
    Reputation
    14
    Thanks
    0
    Do your work yourself. Use
    import java.util.Scanner;
    public class R{
    public static void main(String args[]){
    Scanner lineReader = new Scanner(System.in);
    System.out.println("Enter any string");
    String a = lineReader.nextLine();
    System.out.println("Enter any integer");
    int i = lineReader.nextInt();
    }}

  3. #3
    kjbmarr's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    91
    Reputation
    10
    Thanks
    206
    My Mood
    Tired
    the code above is for accepting user inputs.

    as for shifting the letters, use an array to store the letters and shift them with for loop.

    here is for shifting to right
    Code:
    String letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    		char[] letterArray = letters.toCharArray(); //saves each letter to an array
    		char[] shifted = new char[letters.length()]; //will store the new shifted letters
    		
    		for(int i = 0; i < letters.length(); i++){
    			//shift right
    			if( i != (letters.length()-1) )
    				shifted[i] = letterArray[i+1];
    			else shifted[i] = letterArray[0];
    		}
    		System.out.println( String.valueOf(shifted) );

  4. #4
    dkofek's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    The toilet in the club next to your house
    Posts
    59
    Reputation
    13
    Thanks
    114
    My Mood
    Bored
    Haven't programmed Java for a few years, but from what I remember char type have numeric value.
    try
    Code:
    import java.util.Scanner;
    public class MPGH{
    public static Scanner reader = new Scanner(System.in);
         public static void main(String []args){
             System.out.println("enter a char");
             char c = reader.next().CharAt(0);
             while(c<'A'||c>'Z'&&c<'a'||c>'z')
               {
                   System.out.println("wrong input, please enter a letter between a and z");
                   c = reader.next().CharAt(0);
               }
             if(c>='A'&&c<='Z')
               c+=('a'-'A');                   
             if(c=='z')
               c='a';
             else
               c++;
             System.out.println(c);
         }
    }

  5. #5
    Jew's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    <dd style="overflow: hidden;">here</dd>
    Posts
    3,860
    Reputation
    289
    Thanks
    2,178
    My Mood
    Amazed
    Quote Originally Posted by dkofek View Post
    Haven't programmed Java for a few years, but from what I remember char type have numeric value.
    try
    Code:
    import java.util.Scanner;
    public class MPGH{
    public static Scanner reader = new Scanner(System.in);
    public static void main(String []args){
    System.out.println("enter a char");
    char c = reader.next().CharAt(0);
    while(c<'A'||c>'Z'&&c<'a'||c>'z')
    {
    System.out.println("wrong input, please enter a letter between a and z");
    c = reader.next().CharAt(0);
    }
    if(c>='A'&&c<='Z')
    c+=('a'-'A');
    if(c=='z')
    c='a';
    else
    c++;
    System.out.println(c);
    }
    }
    this thread has been dead for years,look at the latest post
    Vouch thread





     

    Quote Originally Posted by foginho81 View Post
    Hello guys,5 mins ago i dowloaded this program, in 2 minutes i cracked an account, so i purchased Premium for supporting and have unlimited features!

    A+++ Tool GREAT CODER!
    Quote Originally Posted by shadowkiller198 View Post
    I just purchased a Premium account and I haven't had any problems with it!

    Quote Originally Posted by ImShan View Post
    Vouch for this guy!

    I just bought premium and works pretty good.
    Quote Originally Posted by SiiKFO View Post
    Vouch bought premium works very well
    Quote Originally Posted by DarkBlade324 View Post
    vouch i just bought premium it works great
    Quote Originally Posted by coolzombiesg View Post
    Vouch for him

    I just bought premium and works pretty good.
    Quote Originally Posted by KaizoPvP View Post
    VOUCHE: Yep, you are a legit seller, and I like the stuff you do.
    Quote Originally Posted by BTNGaming View Post
    Premium Purchased

Similar Threads

  1. need help with school e2020
    By Omniscientx in forum General
    Replies: 10
    Last Post: 08-30-2013, 06:01 PM
  2. [Solved] Urgently need help with how to make the Hydra hack work! :S
    By crossfire123456789 in forum CrossFire Help
    Replies: 6
    Last Post: 08-27-2011, 08:44 AM
  3. Need help with MC 1.6.5 Beta working
    By Shavreh in forum Minecraft Help
    Replies: 0
    Last Post: 06-05-2011, 11:09 AM
  4. Need help with getting hacks to work
    By asdfgas in forum Combat Arms Help
    Replies: 0
    Last Post: 10-07-2010, 06:53 PM
  5. Need help with hacks working w/ vista?
    By Mu-FFiN in forum Combat Arms Discussions
    Replies: 5
    Last Post: 06-19-2010, 08:20 PM