Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- class Task_Doer
- {
- private static int random()
- {
- double t ;
- int j;
- t=Math.random() ;
- t=t*100 ;
- j=(int) t ;
- return (j%10) ;
- }
- public static void main()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- boolean baba=false;
- int nootimes=1;
- do
- {
- System.out.print("\u000c");
- System.out.println("-----------------------------------------------------");
- System.out.println("| Welcome to the awesome Task DOer ©® !!! |");
- System.out.println("-----------------------------------------------------");
- System.out.println("Enter the task you wanna do among:");
- System.out.println("");
- System.out.println(" ---->Calculations");
- System.out.println("");
- System.out.println(" ---->Future Prediction");
- System.out.println("");
- System.out.println(" ---->Grade Calculator");
- System.out.println("");
- System.out.println(" ---->Letter Triangle Maker");
- System.out.println("");
- System.out.println(" ---->Buzz Number checker");
- System.out.println("");
- System.out.println(" ---->String Reverser");
- System.out.println("");
- System.out.println(" ---->Coin Tosser");
- System.out.println("");
- System.out.println(" ---->Circumference Finder");
- System.out.println("");
- System.out.println(" ---->Random Number Generator");
- System.out.println("");
- System.out.println(" ---->Salamencizoric Code Converter");
- System.out.println("");
- System.out.println(" ---->Random_Programinator");
- System.out.println("");
- System.out.println(" ---->DreSalam Code Converter");
- System.out.println("");
- String task=in.readLine();
- char t=(task.toUpperCase()).charAt(0);
- if(t=='C')
- {
- if(task.charAt(1)=='a'||task.charAt(1)=='A')
- calculator();
- if(task.charAt(1)=='o'||task.charAt(1)=='O')
- coin();
- if(task.charAt(1)=='i'||task.charAt(1)=='I')
- circ();
- }
- else if(t=='F')
- future();
- else if(t=='G')
- grade();
- else if(t=='L')
- lettertriangle();
- else if(t=='B')
- buzz();
- else if(t=='R')
- randprog();
- else if(t=='S')
- {
- if(task.charAt(1)=='t'||task.charAt(1)=='T')
- reverse();
- if(task.charAt(1)=='a'||task.charAt(1)=='A')
- {
- boolean baoba=false;
- long noo=1;
- do
- {
- String sent="",cord="";
- System.out.print("\u000c");
- System.out.println("-----------------------------------------------------");
- System.out.println("Welcome to the code generator. What do you wanna do? |");
- System.out.println("-----------------------------------------------------");
- System.out.println(" ---->Transform a sentence to a code\tEnter transform");
- System.out.println("");
- System.out.println(" ---->Decode a code sentence \tEnter Decode");
- System.out.println("");
- char wtd= ((in.readLine()).toUpperCase()).charAt(0);
- if(wtd=='T')
- {
- System.out.println("Enter the sentence to be transformed. (EVERTHING MUST BE CAPS)");
- sent=in.readLine();
- cord=encrypt(sent);
- System.out.println(" *****Transformation completed!! The code is: *****");
- System.out.println(cord);
- }
- else if(wtd=='D')
- {
- System.out.println("Enter the sentence to be decoded. (EVERTHING MUST BE CAPS)");
- sent=in.readLine();
- cord=encrypt(sent);
- System.out.println(" *****Decoding completed!! The code is: *****");
- System.out.println(cord);
- }
- else
- {
- System.out.println("Sorry, enter something valid!!");
- }
- System.out.println("Repeat the program??\t\t\t Y/N/y/n/yep/yeah/no/yes/nope/neva");
- char yn=in.readLine().charAt(0);
- if(yn=='Y'||yn=='y')
- {
- noo++;
- baoba=true;
- }
- else
- baoba=false;
- System.out.print("\u000c");
- }
- while(baoba);
- System.out.println("You have used this program "+noo+" times.");
- System.out.println("Thanks for using this program.");
- }
- }
- else if(t=='R')
- random5();
- else if(t=='D')
- {
- boolean baoba=false;
- long noo=1;
- do
- {
- String sent="",cord="";
- System.out.print("\u000c");
- System.out.println("-----------------------------------------------------");
- System.out.println("Welcome to the code generator. What do you wanna do? |");
- System.out.println("-----------------------------------------------------");
- System.out.println(" ---->Transform a sentence to a code\tEnter transform");
- System.out.println("");
- System.out.println(" ---->Decode a code sentence \tEnter Decode");
- System.out.println("");
- char wtd= ((in.readLine()).toUpperCase()).charAt(0);
- if(wtd=='T')
- {
- System.out.println("Enter the sentence to be transformed. (EVERTHING MUST BE CAPS)");
- sent=in.readLine();
- cord=dre(sent);
- System.out.println(" *****Transformation completed!! The code is: *****");
- System.out.println(cord);
- }
- else if(wtd=='D')
- {
- System.out.println("Enter the sentence to be decoded. (EVERTHING MUST BE CAPS)");
- sent=in.readLine();
- cord=dre(sent);
- System.out.println(" *****Decoding completed!! The code is: *****");
- System.out.println(cord);
- }
- else
- {
- System.out.println("Sorry, enter something valid!!");
- }
- System.out.println("Repeat the program??\t\t\t Y/N/y/n/yep/yeah/no/yes/nope/neva");
- char yn=in.readLine().charAt(0);
- if(yn=='Y'||yn=='y')
- {
- noo++;
- baoba=true;
- }
- else
- baoba=false;
- System.out.print("\u000c");
- }
- while(baoba);
- System.out.println("You have used this program "+noo+" times.");
- System.out.println("Thanks for using this program.");
- }
- else
- System.out.println("Sorry, wrong choice!");
- System.out.println("Back to the Task DOer ©® !!");
- System.out.println("Repeat the program??\t\t\t Y/N/y/n/yep/yeah/no/yes/nope/neva");
- char yn=in.readLine().charAt(0);
- if(yn=='Y'||yn=='y')
- {
- nootimes++;
- baba=true;
- }
- else
- baba=false;
- System.out.print("\u000c");
- }
- while(baba);
- System.out.println("You have used this program "+nootimes+" times.");
- System.out.println("Task DOer developed and made by Salamencizer");
- System.out.println("Thanks for using this program.");
- }
- private static void calculator()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- char o;
- System.out.println("\u000c");
- char yn=' ';
- int b=1;
- boolean value=false;
- do
- {
- System.out.print("\u000c");
- double c,d,a;
- System.out.println("Calculator");
- System.out.println("Enter:");
- System.out.println("A for Addition");
- System.out.println("B for Subtraction");
- System.out.println("C for Multiplication");
- System.out.println("D for Quotient");
- System.out.println("E for Remainder");
- System.out.println("F for Square Root");
- System.out.println("G for Cube Root");
- System.out.println("H for Power");
- o=(in.readLine().toUpperCase()).charAt(0);
- if(o=='A')
- {
- System.out.println("Enter the two no.s");
- c=Double.parseDouble(in.readLine());
- System.out.println("+");
- d=Double.parseDouble(in.readLine());
- a=c+d;
- System.out.println(c+" + "+d+" = "+a);
- }
- else if(o=='B')
- {
- System.out.println("Enter the two no.s");
- c=Double.parseDouble(in.readLine());
- System.out.println("-");
- d=Double.parseDouble(in.readLine());
- a=c-d;
- System.out.println(c+" - "+d+" = "+a);
- }
- else if(o=='C')
- {
- System.out.println("Enter the two no.s");
- c=Double.parseDouble(in.readLine());
- System.out.println("X");
- d=Double.parseDouble(in.readLine());
- a=c*d;
- System.out.println(c+" X "+d+" = "+a);
- }
- else if(o=='D')
- {
- System.out.println("Enter the two no.s");
- c=Double.parseDouble(in.readLine());
- System.out.println("/");
- d=Double.parseDouble(in.readLine());
- a=c/d;
- System.out.println(c+"/"+d+" = "+a);
- }
- else if(o=='E')
- {
- System.out.println("Enter the two no.s");
- c=Double.parseDouble(in.readLine());
- System.out.println("%");
- d=Double.parseDouble(in.readLine());
- a=c%d;
- System.out.println(c+"%"+d+" = "+a);
- }
- else if(o=='F')
- {
- System.out.println("Enter the number whose square root is to be found");
- c=Double.parseDouble(in.readLine());
- a=Math.sqrt(c);
- System.out.println("Square Root of "+c+" is "+a);
- }
- else if(o=='G')
- {
- System.out.println("Enter the number whose cube root is to be found");
- c=Double.parseDouble(in.readLine());
- a=Math.pow(c,1.0/3.0);
- System.out.println("Square Root of "+c+" is "+a);
- }
- else if(o=='H')
- {
- System.out.println("Enter the numbers");
- c=Double.parseDouble(in.readLine());
- System.out.println("^");
- d=Double.parseDouble(in.readLine());
- a=Math.pow(c,d);
- System.out.println(c+" raised to "+d+" = "+a+".");
- }
- else
- {
- System.out.println("The Operator does not exist");
- }
- }
- while(value);
- System.out.println("You have used this program "+b+" times.");
- System.out.println("Thanks for using this program.");
- System.out.println("This program was developed by Spandan Punwatkar aka Salamencizer");
- }
- private static void future()throws IOException
- {
- System.out.println("\u000c");
- System.out.println("This is a Future Detector");
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- char yn=' ';
- int b=1;
- boolean value=false;
- do
- {
- System.out.println("\u000c");
- System.out.println("Enter the name please");
- String nm=in.readLine();
- System.out.println("Please Wait");
- System.out.print(".");
- for(long i=0;i<=500000000;i++)
- {
- value=false;
- }
- for(long i=0;i<=500000000;i++)
- {
- if(i%100000000==0)
- System.out.print(" .");
- }
- System.out.println();
- if(nm.equalsIgnoreCase("Salamencizer") || nm.equalsIgnoreCase("Spandan") || nm.equalsIgnoreCase("Spawn"))
- {
- System.out.println("#YOLO youre the immortal");
- }
- else
- {
- System.out.println("Youre gonna die!!");
- }
- System.out.println("Continue lookin for futures??\t\t\t\t\tY/N/yes/no/YES/NO/y/n");
- yn=in.readLine().charAt(0);
- if(yn=='y')
- {
- b++;
- value=true;
- }
- else
- {
- value=false;
- }
- }
- while(value);
- System.out.println("You have used this program "+b+" times.");
- System.out.println("Thanks for using this program.");
- }
- private static void grade()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- System.out.println("This is a Grade finder");
- System.out.print("\u000c");
- float p;
- char yn='w';
- System.out.println("Enter your percentage");
- p=Float.parseFloat(in.readLine());
- if(p>=80 && p<=100)
- {
- System.out.println("Your percentage = "+p);
- System.out.println("Your grade - Distinction");
- }
- else if(p>=60 && p<80)
- {
- System.out.println("Your percentage = "+p);
- System.out.println("Your grade - First class");
- }
- else if(p>=45 && p<60)
- {
- System.out.println("Your percentage = "+p);
- System.out.println("Your grade - Second class");
- }
- else if(p>=40 && p<45)
- {
- System.out.println("Your percentage = "+p);
- System.out.println("Your grade - Pass class");
- }
- else if(p<=0)
- {
- System.out.println("Your percentage = "+p);
- System.out.println("Your grade - Epic Fail");
- System.out.println("wait a minute.....are you yashika?? Y/N");
- yn=in.readLine().charAt(0);
- if(yn=='y'||yn=='Y')
- System.out.println("I knew it!!");
- else if(yn=='n'||yn=='N')
- System.out.println("Youre lying!!");
- else
- System.out.println("Enter Y or N, idiot!");
- }
- else if(p<=40)
- {
- System.out.println("Your percentage = "+p);
- System.out.println("Your grade - Fail");
- }
- else
- {
- System.out.println("Percentage more than 100????");
- }
- }
- private static void lettertriangle()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- System.out.println("\u000c");
- System.out.println("This is a Letter triangle maker");
- System.out.println("ENTER the number of letters( A=1, B=2, and so on)");
- int n=Integer.parseInt(in.readLine());
- //HOLA HOLA WE DEM BOYZ
- for(int i=65;i<=65+n;i++)
- {
- for(int j=65;j<=i;j++) //HOLA HOLA HOLA WE DEM BOYZ
- System.out.print((char)j+" ");
- System.out.println();
- }
- }
- private static void buzz()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- int n;
- System.out.print("\u000c");
- System.out.println("A buzz number is a number which");
- System.out.println("is divisible by 7 or has 7 in its units place.");
- System.out.println("Enter an integer to check whether it is a buzz no.");
- n=Integer.parseInt(in.readLine());
- if(n>0)
- {
- if(n%7==0 || (n-7)%10==0)
- {
- System.out.println("This number "+n+" is a buzz no.");
- }
- else
- {
- System.out.println("This number "+n+" is not a buzz no.");
- }
- }
- else if(n==0)
- {
- System.out.println("0 is not a buzz number");
- }
- else
- {
- if(n%7==0 || (n+7)%10==0)
- {
- System.out.println("This number "+n+" is a buzz no.");
- }
- else
- {
- System.out.println("This number "+n+" is not a buzz no.");
- }
- }
- }
- private static void reverse()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- char ch='e';
- System.out.print("\u000c");
- System.out.println("This is a String Reverser");
- System.out.println("Enter the string");
- String y="",x=in.readLine(),s="";
- x=" "+x+" ";
- for(int i=0;i<x.length();i++)
- {
- ch=x.charAt(i);
- if(ch!=' ')
- y=y+ch;
- if(ch==' ')
- {
- s=y+" "+s;
- y="";
- continue;
- }
- }
- System.out.println("The final is :");
- System.out.println(/*"The final is :"+*/s);
- }
- private static void coin()throws IOException
- {
- boolean value=true;
- long baoba=1,ht=0,tt=0;
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- System.out.println("This is a Coin Tosser");
- do
- {
- System.out.print("\u000c");
- double t=0.0;
- int k=0;
- int h=0;
- long j=0,nexus=0;
- for(int i=0;i<5;i++)
- {
- t=Math.random();
- t=t*100;
- j=(int)t;
- nexus=j/10;
- j=j/10;
- //System.out.println("NEXUS IS NOW "+nexus+" "+);
- if(nexus%2==0)
- h++;
- else
- k++;
- }
- if(h>k)
- {
- System.out.println("Tails");
- ht++;
- }
- else
- {
- System.out.println("Heads");
- tt++;
- }
- System.out.println();
- System.out.println();
- System.out.println("Repeat the program??\t\t\t Y/N/y/n/yep/yeah/no/yes/nope/neva");
- char yn=in.readLine().charAt(0);
- if(yn=='Y'||yn=='y')
- {
- baoba++;
- value=true;
- }
- else
- value=false;
- }
- while(value);
- System.out.println("You have used this program "+baoba+" times.");
- System.out.println("The results are: ");
- System.out.println("Tails obtained "+ht+" times");
- System.out.println("Heads obtained "+tt+" times");
- System.out.println("Thanks for using this program.");
- }
- private static void circ()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- System.out.println("\u000c");
- System.out.println("Circumference finder");
- BufferedReader in = new BufferedReader(read);
- float r,d;
- double c,a;
- System.out.println("Enter the radius of the circle in centimeters");
- r=Float.parseFloat(in.readLine());
- d=r*2;a=r*r*3.1415926535897932384626433832795;
- c=d*3.1415926535897932384626433832795;
- System.out.println("The radius of the circle = "+r+" cm ");
- System.out.println("The diameter of the circle = "+d+" cm ");
- System.out.println("The circumference of the circle = "+c+" cm (Approximately)");
- System.out.println("The area of the circle = "+a+" (Approximately)");
- }
- private static void random5()throws IOException
- {
- boolean baba=true;
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- long nootimes=1,e=0,o=0;
- while(baba)
- {
- System.out.println("This program will generate 5 random no.s 4 u");
- System.out.print("\u000c") ;
- double t ;
- int j ;
- for(int i=0;i<5;i++)
- {
- t=Math.random() ;
- t=t*100 ;
- j=(int) t ;
- if((j%10)%2==0)
- e++;
- else
- o++;
- System.out.println(j%10);
- }
- System.out.println("Repeat the program??\t\t\t Y/N/y/n/yep/yeah/no/yes/nope/neva");
- char yn=in.readLine().charAt(0);
- if(yn=='Y'||yn=='y')
- {
- nootimes++;
- baba=true;
- }
- else
- baba=false;
- }
- System.out.println("You have used this program "+nootimes+" times.");
- System.out.println("The results are:");
- System.out.println("Even numbers obtained "+e+" times");
- System.out.println("Odd numjbers obtained "+o+" times");
- System.out.println("Thanks for using this program.");
- }
- private static String encrypt(String senti)
- {
- String sent="";
- senti=senti.toUpperCase();
- char a[]=new char[26];
- char []b=new char[26];int l=0;
- for(int i=0;i<26;i++)
- a[i]=(char)(i+65);
- for(int i=(int)'Z';i>=(int)'A';i--)
- {
- b[l]=(char)i;
- l++;
- }
- for(int i=0;i<senti.length();i++)
- if(Character.isLetter(senti.charAt(i)))
- {
- for(int j=0;j<=25;j++)
- if(senti.charAt(i)==a[j])
- sent=sent+b[j];
- }
- else
- sent=sent+senti.charAt(i);
- return sent;
- }
- private static void randprog()throws IOException
- {
- InputStreamReader read = new InputStreamReader(System.in);
- BufferedReader in = new BufferedReader(read);
- boolean baba=false;
- int progno=0,gel=0,nootimes=1;
- do
- {
- System.out.print("\u000c");
- System.out.println("Take you to a random program?\t\t\tY/N/y/n/yep/yeah/no/yes/nope/neva");
- char yno=in.readLine().charAt(0);
- if(yno=='Y'||yno=='y')
- {
- progno = random();
- if(progno==0)
- calculator();
- else if(progno==1)
- future();
- else if(progno==2)
- grade();
- else if(progno==3)
- lettertriangle();
- else if(progno==4)
- buzz();
- else if(progno==5)
- reverse();
- else if(progno==6)
- coin();
- else if(progno==7)
- circ();
- else if(progno==8)
- random5();
- else if(progno==9)
- {
- boolean baoba=false;
- long noo=1;
- do
- {
- String sent="",cord="";
- System.out.print("\u000c");
- System.out.println("-----------------------------------------------------");
- System.out.println("Welcome to the code generator. What do you wanna do? |");
- System.out.println("-----------------------------------------------------");
- System.out.println(" ---->Transform a sentence to a code\tEnter transform");
- System.out.println("");
- System.out.println(" ---->Decode a code sentence \tEnter Decode");
- System.out.println("");
- char wtd= ((in.readLine()).toUpperCase()).charAt(0);
- if(wtd=='T')
- {
- System.out.println("Enter the sentence to be transformed. (EVERTHING MUST BE CAPS)");
- sent=in.readLine();
- cord=encrypt(sent);
- System.out.println(" *****Transformation completed!! The code is: *****");
- System.out.println(cord);
- }
- else if(wtd=='D')
- {
- System.out.println("Enter the sentence to be decoded. (EVERTHING MUST BE CAPS)");
- sent=in.readLine();
- cord=encrypt(sent);
- System.out.println(" *****Decoding completed!! The code is: *****");
- System.out.println(cord);
- }
- else
- {
- System.out.println("Sorry, enter something valid!!");
- }
- System.out.println("Repeat the program??\t\t\t Y/N/y/n/yep/yeah/no/yes/nope/neva");
- char yn=in.readLine().charAt(0);
- if(yn=='Y'||yn=='y')
- {
- noo++;
- baoba=true;
- }
- else
- baoba=false;
- System.out.print("\u000c");
- }
- while(baoba);
- System.out.println("You have used this program "+noo+" times.");
- System.out.println("Thanks for using this program.");
- }
- }
- else
- System.out.println("Okay!");
- System.out.println("You have returned to the Random Programinator");
- System.out.println("Repeat the program??\t\t\t Y/N/y/n/yep/yeah/no/yes/nope/neva");
- yno=in.readLine().charAt(0);
- if(yno=='Y'||yno=='y')
- {
- nootimes++;
- baba=true;
- }
- else
- baba=false;
- System.out.print("\u000c");
- }
- while(baba);
- System.out.println("You have used this program "+nootimes+" times.");
- System.out.println("Thanks for using this program.");
- }
- private static String dre(String sent)
- {
- sent=sent.toUpperCase();
- char a[]=new char[26];
- char b[]=new char[26];int k=65;
- String news="";
- for(int i=0;i<26;i++,k++)
- a[i]=(char)k;
- k=(int)'N';
- for(int i=0;i<13;i++,k++)
- b[i]=(char)k;
- k=(int)'A';
- for(int i=13;i<26;i++,k++)
- b[i]=(char)k;
- for(int i=0;i<sent.length();i++)
- {
- char t=sent.charAt(i);
- if(Character.isLetter(t))
- {
- for(int j=0;j<=25;j++)
- if(t==a[j])
- news=news+b[j];
- }
- else
- news=news+t;
- }
- return news;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement