samedi 8 février 2020

Is there any different way to write if...if else... statement sentence in this case?

public class Sales {
    public static void main(String[] args) {
        int ursales = 6000;
        int target = 3000;

        if (ursales >= 2 * target) {
            System.out.println("performance Excellent");
            System.out.println("bouns 1000");
        } else if (ursales >= 1.5 * target) {
            System.out.println("performance Fine");
            System.out.println("bouns 500");
        } else if (ursales >= target) {
            System.out.println("performance Satisfactory");
            System.out.println("bouns 100");
        } else {
            System.out.println("You Are Fired!");
        }
    }
}

I tried to write each statement like:

performance = "...";
bonus = "...";

but it didn't work.

Can someone tell me if there is other possible way to write this statements without System.out.println?

Aucun commentaire:

Enregistrer un commentaire