Skip to content

Instantly share code, notes, and snippets.

View paramsingh's full-sized avatar

param paramsingh

View GitHub Profile
import java.util.Scanner;
public class BaseConversion {
//global string because it is used in two methods
static final String encodings = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/";
public static void main(String[] args){
Scanner in = new Scanner( System.in );
//input
System.out.println("Enter the number and the base");
String input = in.nextLine();
String number = input.split(" ")[0];
@paramsingh
paramsingh / WordsToNumber.java
Created February 7, 2013 16:06
Convert a number in english to integers.
//http://www.reddit.com/r/dailyprogrammer/comments/zfeb2/9062012_challenge_96_intermediate_parsing_english/
import java.util.Scanner;
public class WordsToNumber {
//Nine-thousand nine-hundred ninety-nine
public static void main( String[] args ){
Scanner in = new Scanner( System.in );
while( true ){
System.out.println("Enter the string");
String words = in.nextLine();
int val = toNumber( words );
@paramsingh
paramsingh / Vowels.java
Created February 8, 2013 09:01
Practical Question.
import java.util.Scanner;
public class Vowels {
public static void main( String[] args ){
Scanner in = new Scanner( System.in );
System.out.println("Enter the string.");
String input = in.nextLine();
input = input.toUpperCase();
int len = input.length();
int i,j;
int count = 0;
@paramsingh
paramsingh / Encryption.java
Created February 8, 2013 10:29
Encryption question.
import java.util.Scanner;
public class Encryption {
public static void main( String[] args ){
//10181179401 --> 104 97 118 101 --> have
Scanner in = new Scanner( System.in );
System.out.println("Input the stuff");
String input = in.nextLine();
//looping variable
int i = input.length()-1;
//store the ascii value
import java.io.*;
public class Matrixm
{
public static void main(String[] args)throws Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//input
System.out.println("Please enter the order of the first matrix");
import java.util.*;
class date
{
public static void main(String args[])
{
Scanner in =new Scanner(System.in);
System.out.println("Enter the day number");
int dayNumber=Integer.parseInt(in.nextLine());
System.out.println("Enter the year");
int year=Integer.parseInt(in.nextLine());
import java.util.Scanner;
public class WordAlphabetical {
public static void main( String[] args ) {
Scanner in = new Scanner( System.in ) ;
System.out.println("Enter the sentence.");
String sentence = in.nextLine().toUpperCase();
String[] words = sentence.split(" ");
for( int i=0;i<words.length;i++){
for( int j=0;j<words.length;j++){
if( words[i].compareTo(words[j])<0 ){
import java.util.Scanner;
public class Combination {
int n, k;
Combination() {
//default constructor
//initialize data members to 0 or null
n = 0;
k = 0;
}
void read() {
// http://www.respaper.com/isc/552/674.pdf
// Question 9
import java.util.Scanner;
public class Alpha {
String str;
Alpha() {
//default constructor
str = "";
}
public class Personal {
String Name, Pan;
double basic_pay;
int acc_no;
Personal(String n, String p, double b, int a) {
//parametrized constructor
Name = n;
Pan = p;
basic_pay = b;
acc_no = a;