raptrex
03-07-2009, 07:23 AM
ok so i have 4 ints: sales1,sales2,sales3,sales4
they will each have a whole number ie. 100,10920,2901 ect
i need to display a star for every hundred from sales1,2,3,4 after its rounded ie 100 = *, 200 = **
all i can think of is an if else statement like this
if (50 <= sales1 <=150)
{
System.out.println("*");
}
else if (150 <= sales1 <= 250)
{
System.out.println("**");
}
else if (250 <= sales1 <= 350)
{
System.out.println("***");
}
else if (350 <= sales1 <= 450)
this way would take to long as the int can be like in the thousands
but im sure theres an easier/better way to do this so any ideas?
so basically, im trying to get this to be like this:
Store 1: ***************
Store 2: ************
Store 3: ********************
Store 4: *****************
they will each have a whole number ie. 100,10920,2901 ect
i need to display a star for every hundred from sales1,2,3,4 after its rounded ie 100 = *, 200 = **
all i can think of is an if else statement like this
if (50 <= sales1 <=150)
{
System.out.println("*");
}
else if (150 <= sales1 <= 250)
{
System.out.println("**");
}
else if (250 <= sales1 <= 350)
{
System.out.println("***");
}
else if (350 <= sales1 <= 450)
this way would take to long as the int can be like in the thousands
but im sure theres an easier/better way to do this so any ideas?
so basically, im trying to get this to be like this:
Store 1: ***************
Store 2: ************
Store 3: ********************
Store 4: *****************