Help with Bottle Deposit task

i get the necessary outputs when i put the inputs, but the task informs me that my answer is wrong. Can you please tell me what is wrong with this code:

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(;
String line1 = scanner.nextLine();
String line2 = scanner.nextLine();
int smallBottle = Integer.parseInt(line1);
int bigBottle = Integer.parseInt(line2);
double bottle1 = 0.1 * smallBottle;
double bottle2 = 0.25 * bigBottle;
double result = bottle1 + bottle2;



You need to format your result at the end like so:
System.out.printf("%.2f", result);
That method prints your double with 2 digits after the decimal point like the System expects.

1 Like