How could I fix my variables not being initialized ? (dCB, dFT etc.)

Viewed 12
public static void main(String[] args)
    {
        String strNbrF, strNbrC, strCB, strFT, strM, strD;
        
        final double T5 = 0.05, T4 = 0.04, T3 = 0.03, M = 5, T2 = 00.2;
        
        double dNbrF, dNbrC, dTarif, dCB, dFT, dM, dD, dTarifT;
        
        strNbrF = JOptionPane.showInputDialog(null, "Entrez le nombre de feuilles de votre document: ");
        strNbrC = JOptionPane.showInputDialog(null, "Entrez le nombre de copies que vous désirez: ");
        dNbrF = Integer.parseInt(strNbrF);
        dNbrC = Integer.parseInt(strNbrC);
        
        if (dNbrF <= 499)
            dTarif = (T5*dNbrF);
        else if (dNbrF <= 999)
            dTarif = (T4*dNbrF);
        else if (dNbrF>= 1000)
            dTarif = (T3*dNbrF);
        
        
        strCB = JOptionPane.showInputDialog(null, "Repondez par oui ou par non si vous voulez brocher vos copies: ");
        strFT = JOptionPane.showInputDialog(null, "Repondez par oui ou par non si vous voulez avec des feuilles brochés: ");
        strM = JOptionPane.showInputDialog(null, "Etes-vous un membre de l'imprimerie? (oui ou non)" );
        strD = JOptionPane.showInputDialog(null, "Voulez vous avoir vos copies prete en 24h pour 10$ de plus? (oui ou non)");
        
        if  (strCB == "oui" && List.of("Oui", "oui", "OUI").containsAll(null)) 
            dCB = (dNbrC*T2);
        else if (strCB == "non" && List.of("non", "Non", "NON").containsAll(null))
            dCB = 0;

        
        if (strFT == "oui" && List.of("Oui", "oui", "OUI").containsAll(null))
            dFT = (dNbrF*T3);
        else if (strFT == "non" && List.of("Non", "non", "NON").containsAll(null))
            dFT = (dNbrF*T3);
        
        
        if (strM == "oui" && List.of("Oui", "oui", "OUI").containsAll(null))
            dM = 5;
        else if (strM == "non" && List.of("Non", "non", "NON").containsAll(null))
            dM = 0;

        
        if (strD == "oui" && List.of("Oui", "oui", "OUI").containsAll(null))
            dD = 10;
        else if (strD == "non" && List.of("Non", "non", "NON").containsAll(null))
            dD = 0;
        
        
        dTarifT = (dTarif + dCB + dFT + dM + dD);
        
        JOptionPane.showMessageDialog(null, dTarifT);
        
        System.exit(0);

Its saying that my dCB, dFT etc. arent initialized but I put them in my ifs I dont understand. dfiqiuerfnqwijrfbqiuwerbfiuqbrvfihqbrifbqrbfiqbrsifhbqwirbihqbrfbqiwhbrfiqbrfbqeoribviuwbrqbwrifuwqiuebfqbrwfbqroufbouiqwbfqrbfoiqrbfiqwbfibqirwbfiqbfiqbifbqwebfoiqbefiqbwrifobqwifbqibfoiqobrfiuqbrwiufbqibefibqifbqibrfiqowreriybqoiwebfoiqbewofibqrf

0 Answers
Related