Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

array

How to Sort an Arrays of primitive types
Friday, 23 December 2011 00:21
To sort array of primitive types such as int, double or string use method Array.Sort(Array) with the array as a paramater. The primitive types implements interface IComparable, which is internally used by the Sort method (it calls IComparable.ComĀ­pareTo method). See example how to sort int array:


// sort int array
int[] intArray = new int[5] { 8, 10, 2, 6, 3 };
Array.Sort(intArray);
// write array
foreach (int i in intArray) Console.Write(i + " ");

//OUTPUT
2 3 6 8 10

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/XAjB9RinXZI/14309

 
How to Sort Char array
Wednesday, 14 December 2011 00:47
This example uses a character array of three chars and then calls Array.Sort on it to sort it in-place. Then, it loops through all the characters and displays the elements in their new, alphabetical order.


using System;
class Program
{
static void Main()
{
char[] array = { 'y', 'n', 'a' }; // Input array.
Array.Sort(array); // Sort array.
foreach (var c in array) Console.WriteLine(c);
}
}
//Output
// a
// n
// y

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/bR7gyRBipEM/14165

 
Mortgage Payment Calculator in Java
Tuesday, 16 August 2011 23:31
This below Java code will help you to find the monthly payment for the Mortgage payment. Here the array term has months required to payoff the mortgage and array rates interest rate for the mortgage and loan has the loan amount value. This code will perform mortgage comparison


import java.math.*;
import java.text.*;
class MortgageCalculator {
public static void main(String arguments[]) {
//Program Variables using array
double []terms = {84,180,360};//Mortgage Loan Term
double []Rates = {0.0535, 0.055, 0.0575};//Mortgage Loan's Interest Rate
double loan = 200000;//Loan Amount

double term, interestRate; //Temporary variables to make things generic and clearer

DecimalFormat df = new DecimalFormat("$###,###.00"); //Formatting the output

//for each term and Rate starting from the first location of each array terms[] and Rates[]
for (int i=0;i//Calculates the Payment per month to be paid under mortgage scheme One
interestRate=Rates[i]; //take value from the array Rates[] to a temporary variable
term=terms[i]; //take value from the array terms[] to a temporary variable
double monthlyRate = (interestRate/12); //derive the monthly interest rate
//calculate the discount factor
double discountFactor = (Math.pow((1 + monthlyRate), term) -1) / (monthlyRate * Math.pow((1 + monthlyRate), term));
double payment1 = loan / discountFactor; //calculate payable amount per month
//Output for mortage scheme One
System.out.println("The Loan amount is:"+df.format(loan)+"\n");
System.out.println("The intrest rate is:"+interestRate*100+"%");
System.out.println("The term of the loan is:"+term/12+" years.");
System.out.println("Monthly Payment Amount: " + df.format(payment1)+"\n");
}
}
}

For online mortgage comparison Mortgage Payment Calculator

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/haOlc6tVTE0/13539

 
Convert Windows-1251 to UTF8
Tuesday, 10 May 2011 23:51

function win_to_utf8 ($string) {
$in_arr = array (
chr(208), chr(192), chr(193), chr(194),
chr(195), chr(196), chr(197), chr(168),
chr(198), chr(199), chr(200), chr(201),
chr(202), chr(203), chr(204), chr(205),
chr(206), chr(207), chr(209), chr(210),
chr(211), chr(212), chr(213), chr(214),
chr(215), chr(216), chr(217), chr(218),
chr(219), chr(220), chr(221), chr(222),
chr(223), chr(224), chr(225), chr(226),
chr(227), chr(228), chr(229), chr(184),
chr(230), chr(231), chr(232), chr(233),
chr(234), chr(235), chr(236), chr(237),
chr(238), chr(239), chr(240), chr(241),
chr(242), chr(243), chr(244), chr(245),
chr(246), chr(247), chr(248), chr(249),
chr(250), chr(251), chr(252), chr(253),
chr(254), chr(255)
);
$out_arr = array (
chr(208).chr(160), chr(208).chr(144), chr(208).chr(145),
chr(208).chr(146), chr(208).chr(147), chr(208).chr(148),
chr(208).chr(149), chr(208).chr(129), chr(208).chr(150),
chr(208).chr(151), chr(208).chr(152), chr(208).chr(153),
chr(208).chr(154), chr(208).chr(155), chr(208).chr(156),
chr(208).chr(157), chr(208).chr(158), chr(208).chr(159),
chr(208).chr(161), chr(208).chr(162), chr(208).chr(163),
chr(208).chr(164), chr(208).chr(165), chr(208).chr(166),
chr(208).chr(167), chr(208).chr(168), chr(208).chr(169),
chr(208).chr(170), chr(208).chr(171), chr(208).chr(172),
chr(208).chr(173), chr(208).chr(174), chr(208).chr(175),
chr(208).chr(176), chr(208).chr(177), chr(208).chr(178),
chr(208).chr(179), chr(208).chr(180), chr(208).chr(181),
chr(209).chr(145), chr(208).chr(182), chr(208).chr(183),
chr(208).chr(184), chr(208).chr(185), chr(208).chr(186),
chr(208).chr(187), chr(208).chr(188), chr(208).chr(189),
chr(208).chr(190), chr(208).chr(191), chr(209).chr(128),
chr(209).chr(129), chr(209).chr(130), chr(209).chr(131),
chr(209).chr(132), chr(209).chr(133), chr(209).chr(134),
chr(209).chr(135), chr(209).chr(136), chr(209).chr(137),
chr(209).chr(138), chr(209).chr(139), chr(209).chr(140),
chr(209).chr(141), chr(209).chr(142), chr(209).chr(143)
);
$out = str_replace($in_arr,$out_arr,$string);
return $out;
}

Canadian Ativan diet pills without prescription. Ativan ups cod. Ativan 1 business day delivery. Order Ativan without prescription. Ativan buy fedex.

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/KlnogNa8FhI/13203

 
Max value C#
Sunday, 13 February 2011 00:35
//This code contains a function that does what the example function at the beginning of //this chapter hoped
//to do. It accepts an array of integers as a parameter and returns the highest number //in the array. The
//function definition is as follows:

static int MaxValue(int[] intArray)
{
int maxVal = intArray[0];
for (int i = 1; i < intArray.Length; i++)
{
if (intArray[i] > maxVal)
maxVal = intArray[i];
}
return maxVal;
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/70XNBXkyb7A/12945

 
Start
Prev
1


Page 1 of 2
Taxonomy by Zaragoza Online