Advertisement
Guest User

szyfr cezara

a guest
Nov 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.67 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package szyfr.cezara;
  7.  
  8. import java.util.*;
  9. /**
  10.  *
  11.  * @author Ignacy
  12.  */
  13. public class SzyfrCezara {
  14.  
  15.     /**
  16.      * @param args the command line arguments
  17.      */
  18.     public static void main(String[] args) {
  19.    
  20.         Scanner odczyt = new Scanner(System.in);
  21.        
  22.        
  23.         String alfabet = "abcdefghijklmnopqrstuvwxyz ";
  24.        
  25.         String tekst = " ";
  26.         System.out.println("Podaj tekst do zapisania:");
  27.         tekst = odczyt.nextLine();
  28.  
  29.        
  30.         int n=0;
  31.         System.out.println("Podaj o ile chcesz przesunąć liczbę w zapisie szyfru: ");
  32.         n = odczyt.nextInt();
  33.  
  34.         String wynik = null;          
  35.        
  36.         if(n>0){
  37.        
  38.      //   n=27+n;
  39.        
  40.  
  41.             for(int i=0; i<tekst.length(); i++){
  42.                 for(int j=0;j<alfabet.length();j++){
  43.                     if(tekst.charAt(i)==tekst.length())
  44.                         char tekst.charAt(i)=(char)wynik;
  45.                        
  46.                         //wynik+=alfabet.charAt((i+n)%alfabet.length());
  47.                         }
  48.         }
  49.     }
  50.        
  51.        
  52.         System.out.println(wynik);
  53.        
  54.        
  55.        
  56.        
  57.        
  58.         }        
  59.  
  60.     private static String charAt(int i) {
  61.         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  62.     }
  63.        
  64.        
  65.        
  66.        
  67.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement