Loading...
stoio12 avatar stoio12 -1 Точки

Не мога да разбера къде ми е грешката в задача 8. Pet Shop.

Здравейте, пробвам се да реша задача 8, но когато поставя кода който съм написал ми излизат следните грешки:

 

Zero test #1 (Incorrect answer)

The zero tests are not included in the final result.

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.
The number of numbers in the user output is less than the expected output.

Show input

Expected output:

Your output:

 


 

1

28.5

 

1

Time used: 0.053 s

Memory used: 0.00 MB

Zero test #2 (Incorrect answer)

The zero tests are not included in the final result.

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.
The number of numbers in the user output is less than the expected output.

Show input

Expected output:

Your output:

 


 

1

68.5

 


 

1

Time used: 0.052 s

Memory used: 0.00 MB

Test #1 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.058 s

Memory used: 0.00 MB

Test #2 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.053 s

Memory used: 0.00 MB

Test #3 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.048 s

Memory used: 0.00 MB

Test #4 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.053 s

Memory used: 0.00 MB

Test #5 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.055 s

Memory used: 0.00 MB

Test #6 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.062 s

Memory used: 0.00 MB

Test #7 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.049 s

Memory used: 0.00 MB

Test #8 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.056 s

Memory used: 0.00 MB

Test #9 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Time used: 0.051 s

Memory used: 0.00 MB

Test #10 (Incorrect answer)

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

Кода който съм написал е следния :

import java.util.Scanner;

public class Petshop {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int dog = Integer.parseInt(scan.nextLine());
int cat = Integer.parseInt(scan.nextLine());
double dogPrize = dog * 2.50;
int catPrize = cat * 4;
System.out.println( dogPrize + catPrize + "lv.");

}
}

Моля, за съдействие и обяснение къде и какво бъркам. 

Благодаря ви предварително.

 

 

 

Тагове:
-1
Programming Basics with Java
icowwww avatar icowwww 2813 Точки

Добави символ спейс преди lv. :

System.out.println( dogPrize + catPrize + " lv.");

0
Alish12 avatar Alish12 -2 Точки

adding the space character before lv will only improve the readablity in the output. Addting it or not, doesn't affect the code. 

 

The code looks fine to me.

Please ensure that you are providing valid input values, which are two Integers values. 

It can also be a platform-specific issue and may not be related to the code. Try running this code on Java IDE or a text editor with Java support. 

0
extraMU avatar extraMU 1 Точки

Трябва да сложиш още едни скоби : System.out.println((dogPrize + catPrize) + "lv.");

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.