Софтуерно Инженерство
Loading...
+ Нов въпрос
Tspetrova avatar Tspetrova 65 Точки

Tech Module -Intro and Basic Syntax - Exercise- Vacation

Здравейте, някой може ли да ми каже защо judge ми дава 83 %

https://pastebin.com/rWsB4mA7

You are given a group of people, type of the group, on which day of the week they are going to stay. Based on that information calculate how much they have to pay and print that price on the console. Use the table below. In each cell is the price for a single person. The output should look like that: "Total price: {price}". The price should be rounded to the second decimal point.

 

Friday

Saturday

Sunday

Students

8.45

9.80

10.46

Business

10.90

15.60

16

Regular

15

20

22.50

There are also discounts based on some conditions:

  • Students – if the group is bigger than or equal to 30 people you should reduce the total price by 15%
  • usiness – if the group is bigger than or equal to  100 people 10 of them can stay for free.
  • Regular – if the group is bigger than or equal 10 and less than or equal to 20 reduce the total price by 5%

You should reduce the prices in that EXACT order

Examples

Input

Output

30

Students

Sunday

Total price: 266.73

40

Regular

Saturday

Total price: 800.00

Тагове:
0
Technology Fundamentals
Hristo13 avatar Hristo13 165 Точки
Best Answer

Смени 49ти ред с else if ("Regular".equals(choice) && group >= 10 && group <= 20)

 В момента както ти е кода Business и Students могат да влязат в тая проверка на 49ти ако не отговарят на собствените си изисквания отгоре.

 

edit: Материала напред ли взимаш?

0
15/03/2019 18:58:43
Tspetrova avatar Tspetrova 65 Точки

Много благодаря, изпуснала съм го от условието :-) понякога най-елементарините грешки са най-трудни за намиране

Да, предварително минавам материала, за да ми е по-лесно....че с работа и учене е тегаво :-)

0
18/03/2019 09:23:08
Plamen_dimitrov avatar Plamen_dimitrov 12 Точки
На 48ми ред май трябва да е: totalPrice += (group - 10) * price;
0
Tspetrova avatar Tspetrova 65 Точки

Така дава още по-малко точки....

0