Sunday, September 14, 2014

Visitors2Cash

Visitors2Cash

http://Visitors2Cash.com/ref.php?refId=180099

Visitors2Cash advertising media is a leading online advertising company.
With Visitors2Cash.com's money making system you can easily earn money
by sharing referral links to your friends, family and other people through
websites, blogs, forums, social media, facebook wall, facebook pages, groups,
twitter, chat rooms and other media.

Wednesday, September 10, 2014

Read Inverse

public static void main(String args[]) throws IOException { String num[] = new String[5]; boolean choose = false; String ask; int l = num.length; BufferedReader z = new BufferedReader(new InputStreamReader(System.in)); while (!choose) { for (int i = 0; i < l; i++) { System.out.print(" Enter a number or String : "); num[i] = z.readLine(); } System.out.println(" The oppossing order of the given numbers are : "); for (int i = l - 1; i >= 0;) { System.out.print(" " + num[i]); i--; } System.out.println(" \n" + "Do you want to try again ? (y/n) "); ask = z.readLine(); if (ask.equals("y")) { choose = false; } else if (ask.equals("n")) { choose = true; } } } }

BirthDAy

public static void main (String args []) throws IOException{ int day, month ,year; BufferedReader z = new BufferedReader( new InputStreamReader(System.in)); System.out.println( " ENTER DATA AS NEEDED " + "\n"); System.out.print(" Enter day in number : "); day = Integer.parseInt(z.readLine()); System.out.print(" Enter month in number : "); month = Integer.parseInt(z.readLine()); System.out.print(" Enter year in number : "); year = Integer.parseInt(z.readLine()); if(month == 1){ System.out.println("January" + " " + day + " , " + year); }else if(month==2){ System.out.println("February"+" " + day + " , "+ year); }else if(month==3){ System.out.println("March"+" " + day + " , "+ year); } else if(month==4){ System.out.println("April"+" " + day + " , "+ year); } else if(month==5){ System.out.println("May"+" " + day + " , "+ year); } else if(month==6){ System.out.println("June"+" " + day + " , "+ year); } else if(month==7){ System.out.println("July"+" " + day + " , "+ year); } else if(month==8){ System.out.println("August"+" " + day + " , "+ year); } else if(month==9){ System.out.println("September"+" " + day + " , "+ year); } else if(month==10){ System.out.println("October"+" " + day + " , "+ year); } else if(month==11){ System.out.println("November"+" " + day + " , "+ year); } else if(month==12){ System.out.println("December"+ " " + day + " , "+ year); } } }

Quick Sort

private static class Quicksort { int array[]; int size; public Quicksort(int n) { size = n; //create array with size n+1 array = new int[n + 1]; //asign value into the array for (int i = 0; i < n; i++) { array[i] = (int) Math.round(Math.random() * 89 + 10); } //set the last element as big value array[n] = 99999; } public int partition(int p, int q) { int i = p; int j = q + 1; // Get the pivot element from the middle of the list int pivot = array[p]; // Divide into two lists do { // If the current value from the left list is smaller then the pivot // element then get the next element from the left list do { i++;// As we not get we can increase i } while (array[i] < pivot); // If the current value from the right list is larger then the pivot // element then get the next element from the right list do { j--;// As we not get we can increase j } while (array[j] > pivot); // If we have found a values in the left list which is larger then // the pivot element and if we have found a value in the right list // which is smaller then the pivot element then we exchange the values. if (i < j) { swap(i, j); } } while (i < j); //swap the pivote element and j th element swap(p, j); return j; } private void swap(int p, int j) { //exachage the elements int temp = array[p]; array[p] = array[j]; array[j] = temp; } public void quicksort() { // Recursion quicksort(0, size - 1); } public void quicksort(int p, int q) { int j; if (p < q) { // Divide into two lists j = partition(p, q); // Recursion quicksort(p, j - 1); quicksort(j + 1, q); } } public void print() { //print the elements of array for (int i = 0; i < size; i++) { System.out.print(array[i] + " | "); } System.out.println(); } public static void main(String args[]) { Quicksort q = new Quicksort(15); System.out.println("Before Sort <<<<<<<<<<<<<<<<<<<<<"); q.print(); q.quicksort(); System.out.println("After Sort > > > > > > > > > > > >"); q.print(); System.out.println("=======+============+=======+============+=======+============"); Quicksort q2 = new Quicksort(125); System.out.println("Before Sort <<<<<<<<<<<<<<<<<<<<<"); q2.print(); q2.quicksort(); System.out.println("After Sort > > > > > > > > > > > >"); q2.print(); System.out.println("=======+============+=======+============+=======+============"); Quicksort q3 = new Quicksort(5); System.out.println("Before Sort <<<<<<<<<<<<<<<<<<<<<"); q3.print(); q3.quicksort(); System.out.println("After Sort > > > > > > > > > > > >"); q3.print(); } } }

Natoinal Wedgits Payroll

public static void main(String[] args) { double d_Employee1, d_Employee2, d_Employee3, d_Employee4, d_Employee5; double hrs1 = 40, hrs2 = 24, hrs3 = 10, hrs4 = 5, hrs5 = 35; double d_rate = 9.50, d_rate2 = 8.75, d_rate3 = 10.95, d_rate4 = 6.75, d_rate5 = 15.50; double gross1, gross2, gross3, gross4, gross5; double tax1, tax2, tax3, tax4, tax5; double net1, net2, net3, net4, net5; double Total_Gross, Total_tax, Total_net; d_Employee1 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_Employee1")); d_Employee2 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_Employee2")); d_Employee3 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_Employee3")); d_Employee4 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_Employee4")); d_Employee5 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_Employee5")); d_rate = Double.parseDouble(JOptionPane.showInputDialog("Enter d_rate")); d_rate2 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_rate2")); d_rate3 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_rate3")); d_rate4 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_rate4")); d_rate5 = Double.parseDouble(JOptionPane.showInputDialog("Enter d_rate5")); gross1 = hrs1 * d_rate; gross2 = hrs2 * d_rate2; gross3 = hrs3 * d_rate3; gross4 = hrs4 * d_rate4; gross5 = hrs5 * d_rate5; tax1 = .35 * gross1; tax2 = .35 * gross2; tax3 = .35 * gross3; tax4 = .35 * gross4; tax5 = .35 * gross5; net1 = gross1 - tax1; net2 = gross2 - tax2; net3 = gross3 - tax3; net4 = gross4 - tax4; net5 = gross5 - tax5; Total_Gross = gross1 + gross2 + gross3 + gross4 + gross5; Total_tax = tax1 + tax2 + tax3 + tax4 + tax5; Total_net = net1 + net2 + net3 + net4 + net5; System.out.print("National Wiidgets"); System.out.println(); System.out.print("Payroll Report"); System.out.println(); System.out.print("Employee no.\t\t Hrs\t\t Rate\t\t Gross\t\t\t Tax\t\t\t Net"); System.out.println(); System.out.println("----------------------------------------------------------------------------------------------------------------------"); System.out.println(d_Employee1 + "\t\t\t" + hrs1 + "\t\t" + d_rate + "\t\t" + gross1 + "\t\t\t" + tax1 + "\t\t\t" + net1); System.out.println(); System.out.println(d_Employee2 + "\t\t\t" + hrs2 + "\t\t" + d_rate2 + "\t\t" + gross2 + "\t\t\t" + tax2 + "\t\t\t" + net2); System.out.println(); System.out.println(d_Employee3 + "\t\t\t" + hrs3 + "\t\t" + d_rate3 + "\t\t" + gross3 + "\t\t\t" + tax3 + "\t\t\t" + net3); System.out.println(); System.out.println(d_Employee4 + "\t\t\t" + hrs4 + "\t\t" + d_rate4 + "\t\t" + gross4 + "\t\t\t" + tax4 + "\t\t\t" + net4); System.out.println(); System.out.println(d_Employee5 + "\t\t\t" + hrs5 + "\t\t" + d_rate5 + "\t\t" + gross5 + "\t\t\t" + tax5 + "\t\t\t" + net5); System.out.println("----------------------------------------------------------------------------------------------------------------------"); System.out.println(); Total_Gross = gross1 + gross2 + gross3 + gross4 + gross5; Total_tax = tax1 + tax2 + tax3 + tax4 + tax5; Total_net = net1 + net2 + net3 + net4 + net5; System.out.println("\t\t\t\t\t\tTotal Gross is: " + Total_Gross + "\tTotal Tax is: " + Total_tax + "\tTotal Net is: " + Total_net); } }

advertisement