TOPIC

Wrong (100%)

lnunes55 asked 2 years ago

Pessoal, alguém me ajuda. Não sei qual o erro, uma vez que a minha solução é funcional.

import java.io.IOException;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException{
        Scanner entrada = new Scanner(System.in);
        entrada.nextLine();
        double salario = entrada.nextDouble();
        double t_venda = entrada.nextDouble()*0.15;
        DecimalFormat decimalFormat = new DecimalFormat("#,##0.00");
        decimalFormat.setRoundingMode(RoundingMode.HALF_EVEN);
        System.out.println("TOTAL = R$ "+ decimalFormat.format(salario+t_venda));
        entrada.close();

    }

}

Remember not post solutions. Your post may be reviewed by our moderators.

  • dbastos15 replied 1 year ago

    import java.io.IOException;import java.util.Scanner;
    
    /**
     * IMPORTANT: 
     *      O nome da classe deve ser "Main" para que a sua solução execute
     *      Class name must be "Main" for your solution to execute
     *      El nombre de la clase debe ser "Main" para que su solución ejecutar
     */
    public class Main {
    
        public static void main(String[] args) throws IOException {
    
            Scanner sc = new Scanner(System.in);
            String nome = sc.next();
            double salario = sc.nextDouble();
            double totalVendas = sc.nextDouble();
    
            System.out.printf("TOTAL = R$ %.2f%n", salario 
            + (totalVendas*0.15));
    
        }
    
    }
  • JeffersondaSilvaSouza replied 2 years ago

    Ola Lucas, tudo certo?

    Também tive problemas para ele aceitar essa solução mesmo passando várias corretas ele dava erro "Presentation Error".

    Fiz algo similar ao seu e no fim acabou sendo aceito.

    https://www.beecrowd.com.br/judge/pt/runs/code/26520082

    ''' import java.io.IOException; import java.util.Scanner;

    public class Main {

    public static void main(String[] args) throws IOException {
    
        String name;
        double percSale, totalSales, salFix, totalSal;
        Scanner read = new Scanner(System.in);
    
        name = read.nextLine();
        salFix = read.nextDouble();
        totalSales = read.nextDouble();
    
        percSale = (totalSales * 15 / 100  );
        totalSal = percSale + salFix;
    
        System.out.printf("TOTAL = R$ %.2f\n", totalSal);
        read.close();
    
    }

    } '''