Happiness calculator

Report a typo

Here is a Java program designed to calculate happiness using a specific formula: (life+laughter)∗love−hate/2(life+laughter)*love−hate/2. However, the expression in the code is incomplete. Please complete the formula to help the author determine his happiness score.

Fill in the gaps with the relevant elements
public class Happiness {
    public static void main(String[] args) {
        double life = 8.6;
        double laughter = 9.0;
        double love = 7.3;
        double hate = 2.3;
        System.out.println("Happiness = " + (life  laughter love - hate  2.0));
    }
}

Create a free account to access the full topic