For some reason, there is no output coming from the return statement when i run the program, i don't see what i'm doing wrong.
The system.out method does give output, but the return s does nothing. In the test class i call the method through:
Any help please?
Code:
public class Supermarkets
{
String[] cities = { "Miami", "Sunrise", "Hollywood" , "Tallahasse" , "Jacksonville" , "Orlando" , "Gainesville" , "Pensacola" , "Ocala" , "Sebring"};
double[] profit = {10200000.00, 14600000.00, 17000000.00, 6000000.00, 21600000.00, 9100000.00, 8000000.00, 12500000.00, 2000000.00, 4500000.00};
DecimalFormat d = new DecimalFormat();
String display()
{
String s = "";
for(int i = 0; i < profit.length; i++)
{
//System.out.println(cities[i] + " " + d.format(profit[i]));
s = s + cities[i] + " " + profit[i] + "/n";
}
return s;
}
Code:
public static void main(String[] arg)
{
Supermarkets beam = new Supermarkets();
beam.display();
}
Comment