Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- import java.util.*;
- public class NumberJeopardy
- {
- public static void main(String [] args)
- {
- System.out.println("Gimme your Equations");
- Scanner console = new Scanner(System.in);
- String input = console.next();
- System.out.println(input);
- }
- }
- 2.
- import java.util.*;
- public class Bronumbers
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- System.out.println("Onii chan gimme the amount of numbers you wanna input");
- int number = console.nextInt();
- for(int i = 0; i < number)
- {
- String input = console.next();
- if(input.length == 5)
- {
- System.out.println("3");
- }
- else
- {
- if(input.charAt(0) == o)
- {
- if(input.charAt(1) == w)
- {
- if(input.charAt(2) == e)
- {
- System.out.println("1")
- }
- else
- {
- System.out.println("2")
- }
- }
- else if(input.chartAt(1) == n)
- {
- System.out.println("1")
- }
- }
- else
- {
- if(chartAt(1) == n)
- {
- if(charAt(2) == e)
- {
- System.out.println("1");
- }
- else
- {
- System.out.prntln("2");
- }
- }
- }
- }
- }
- }
- 3.
- /**
- * Created by WillieShi on 8/26/2017.
- */
- import java.util.*;
- public class Depreciation
- {
- public static double[][] deprecbymonth;
- public static void main(String[] args)
- {
- int months;
- double down;
- double loanleft;
- double carvalue;
- int numrec;
- int monthcount = 0;
- Scanner console = new Scanner(System.in);
- System.out.print("Gimme the info about your debt");
- String data = console.next();
- Scanner stringbreak = new Scanner(data);
- months = Integer.parseInt(stringbreak.next());
- down = Double.parseDouble(stringbreak.next());
- loanleft = Double.parseDouble(stringbreak.next());
- numrec = Integer.parseInt(stringbreak.next());
- deprecbymonth = new double[months+1][2];
- carvalue = loanleft+500;
- populate(deprecbymonth, numrec, months);
- while(carvalue < loanleft)
- {
- carvalue = carvalue- carvalue*deprecbymonth[2][monthcount];
- loanleft = loanleft - 500;
- System.out.println(carvalue+ " " + loanleft);
- monthcount++;
- }
- }
- public static void populate(double[][] deprecbymonth, int numrec, int months)
- {
- int month;
- double depval;
- int prevmonth = 0;
- double predepval = 0.0;
- String temp;
- Scanner console = new Scanner(System.in);
- for(int i = 0; i< numrec; i++)
- {
- System.out.println("Gimme the" + i + "th datapoint");
- temp = console.next();
- Scanner stringbreak = new Scanner(temp);
- month = Integer.parseInt(stringbreak.next());
- depval = Double.parseDouble(stringbreak.next());
- if(i != 0)
- {
- if(i == numrec-1)
- {
- for(i = prevmonth; i <= month; i++)
- {
- deprecbymonth[2][i] = depval;
- }
- }
- else
- {
- for(i = prevmonth; i <= month - prevmonth; i++)
- {
- deprecbymonth[2][i] = predepval;
- }
- }
- }
- prevmonth = month;
- predepval = depval;
- }
- }
- }
- 4.
- import java.util.*;
- public class mrBean
- {
- public static void main(String[] args)
- {
- int amount;
- int temp;
- int count = 0;
- String templine;
- System.out.println("Give me the amount of inputs");
- Scanner console = new Scanner(System.in);
- amount = console.nextInt();
- console.nextLine();
- for(int i = 0; i < amount; i++)
- {
- System.out.println("Gimme the input" + (i+1));
- templine = console.nextLine();
- Scanner stringbreak = new Scanner(templine);
- for(int y = 0; y < 3; y++)
- {
- temp = Integer.parseInt(stringbreak.next());
- if(temp > 20 )
- {
- System.out.println(temp);
- System.out.println("Case" + (i+1) + "bad");
- break;
- }
- count++;
- }
- if(count == 3)
- {
- System.out.println("Case" + i+1 + "good");
- count = 0;
- }
- }
- }
- }
- 5.
- import java.util.*;
- public class hajj
- {
- public static void main(String[] args)
- {
- System.out.println("Input");
- Scanner dingus = new Scanner(System.in);
- String output = "";
- String dingle;
- int i = 1;
- do
- {
- dingle = dingus.nextLine();
- if(dingle.equals("Hajj"))
- {
- output += "Case " + i + ": Hajj-e-Akbar /n";
- }
- else if(dingle.equals("Umrah"))
- {
- output += "Case " + i + ": Hajj-e-Asghar /n";
- }
- else
- {
- break;
- }
- i++;
- }
- while(dingle != "*");
- System.out.println(output);
- }
- }
- 6.
- import java.util.*;
- public class Donate
- {
- public static void main(String [] args)
- {
- int inputs;
- String temp;
- int money = 0;
- Scanner console = new Scanner(System.in);
- inputs = Integer.parseInt(console.nextLine());
- for(int i = 0; i < inputs; i++)
- {
- temp = console.nextLine();
- Scanner stringbreak = new Scanner(temp);
- if(stringbreak.next() == "donate")
- {
- money = money + Integer.parseInt(stringbreak.next());
- }
- else
- {
- System.out.println(money);
- }
- }
- }
- }
- 7.
- import java.util.*;
- public class Swallow
- {
- public static void main(String[]args)
- {
- int repeattimes;
- int columns;
- String tempinput;
- boolean test = true;
- int gaps = 0;
- int x;
- int y;
- Scanner console = new Scanner(System.in);
- System.out.println("Gimme the repeats");
- repeattimes = console.nextInt();
- console.nextLine();
- System.out.println("Gimme the columns");
- columns = console.nextInt();
- console.nextLine();
- for(int i = 0; i < repeattimes; i++)
- {
- for(int j = 0; j < columns; j++)
- {
- System.out.println("Gimme the column");
- tempinput = console.nextLine();
- Scanner stringbreak = new Scanner(tempinput);
- x = Integer.parseInt(stringbreak.next());
- y = Integer.parseInt(stringbreak.next());
- if(j == 0)
- {
- gaps = x - y;
- }
- else
- {
- if(x - y != gaps)
- {
- test = false;
- }
- }
- }
- if(test = true)
- {
- System.out.println("yes");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment