sorry if this is the wrong place to ask this sort of question but i am a complete newbie at java and i was wondering is there a way to make this more compact:
if (PlainFlourUsed <2000)
System.out.println("\n0 Bags of Flour needed");
else if (PlainFlourUsed >= 2000 && PlainFlourUsed < 4000)
System.out.println("\n1 Bag of flour needed");
else if (PlainFlourUsed >= 4000 && PlainFlourUsed< 6000)
System.out.println("\n2 Bag's of flour needed");
else if (PlainFlourUsed >= 6000 && PlainFlourUsed < 8000)
System.out.println("\n3 Bag's of flour needed");
else if (PlainFlourUsed >= 8000 && PlainFlourUsed< 10000)
System.out.println("\n4 Bag's of flour needed");
else if (PlainFlourUsed >= 10000 && PlainFlourUsed < 12000)
System.out.println("\n5 Bag's of flour needed");
else if (PlainFlourUsed >= 12000 && PlainFlourUsed< 14000)
System.out.println("\n6 Bag's of flour needed");
else if (PlainFlourUsed >= 14000 && PlainFlourUsed < 16000)
System.out.println("\n7 Bag's of flour needed");
else if (PlainFlourUsed >= 16000 && PlainFlourUsed< 18000)
System.out.println("\n8 Bag's of flour needed");
else if (PlainFlourUsed >= 20000 && PlainFlourUsed < 22000)
System.out.println("\n9 Bag's of flour needed");
else if (PlainFlourUsed >= 24000 && PlainFlourUsed < 26000)
System.out.println("\n10 Bag's of flour needed");
Aucun commentaire:
Enregistrer un commentaire