Sat Jun 23, 2007 1:21 pm
// Determining how many sales person earn salaries
public class Salary
{
public static void main (String args [])
{
// intializer list specifies the integers amount
double salary [] = { 0, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200};
int value []= new int [11];
System.out.printf( "%s:%20s:\n", "Index", " Value"); // column heading
for (int index = 0; index < (salary.length); index++)
{
if (10<=(int)math.floor(((salary[index]*(.9)+200)*.01)))
++value[10];
else
++value[(int)math.floor(((salary [index]* (.9)+200)*.01))];
}
for (int index1 =2; index1<value.length-1; index1++)
System.out.printf("$%5d-%5d: %10d\n",
index1 *100,index1 * 100 + 99, value[index1]);
// output each salary element's value.
for (int index2 =11; index2<= value.length; index2++ )
System.out.printf( "$%5d%5s: 20d\n", index2*100-100, "& more", value[10]);
} // end main
} // end class Salary
Sat Jun 23, 2007 1:50 pm
public class Salary
{
public static void main (String args [])
{
// intializer list specifies the integers amount
double salary [] = { 0, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200};
int value []= new int [11];
System.out.printf( "%s:%20s:\n", "Index", " Value"); // column heading
for (int index = 0; index < (salary.length); index++)
{
if (10<=(int)Math.floor(((salary[index]*(.9)+200)*.01)))
++value[10];
else
++value[(int)Math.floor(((salary [index]* (.9)+200)*.01))];
}
for (int index1 =2; index1<value.length-1; index1++)
System.out.printf("$%5d-%5d: %10d\n",
index1 *100,index1 * 100 + 99, value[index1]);
// output each salary element's value.
for (int index2 =11; index2<= value.length; index2++ )
System.out.printf( "$%5d%5s: 20d\n", index2*100-100, "& more", value[10]);
} // end main
} // end class Salary
Sat Jun 23, 2007 2:12 pm
Sat Jun 23, 2007 2:24 pm
if (10<=(int)math.floor(((salary[index]*(.9)+200)*.01)))
if (10<=(int)Math.floor(((salary[index]*(.9)+200)*.01)))
Mon Jun 25, 2007 6:38 pm
Mon Feb 14, 2011 6:17 am
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.