Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package szyfr.cezara;
- import java.util.*;
- /**
- *
- * @author Ignacy
- */
- public class SzyfrCezara {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner odczyt = new Scanner(System.in);
- String alfabet = "abcdefghijklmnopqrstuvwxyz ";
- String tekst = " ";
- System.out.println("Podaj tekst do zapisania:");
- tekst = odczyt.nextLine();
- int n=0;
- System.out.println("Podaj o ile chcesz przesunąć liczbę w zapisie szyfru: ");
- n = odczyt.nextInt();
- String wynik = null;
- if(n>0){
- // n=27+n;
- for(int i=0; i<tekst.length(); i++){
- for(int j=0;j<alfabet.length();j++){
- if(tekst.charAt(i)==tekst.length())
- char tekst.charAt(i)=(char)wynik;
- //wynik+=alfabet.charAt((i+n)%alfabet.length());
- }
- }
- }
- System.out.println(wynik);
- }
- private static String charAt(int i) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement