This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.respaper.com/isc/552/674.pdf | |
// Question 9 | |
import java.util.Scanner; | |
public class Alpha { | |
String str; | |
Alpha() { | |
//default constructor | |
str = ""; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
OlderNewer