Професионална програма
Loading...
+ Нов въпрос
AlexanderF avatar AlexanderF 2 Точки

Regular Expressions - Furniture 0/100

https://pastebin.com/yKgcikZa

Мисля, че ползвам правилен regexp, но пак не ми мачва някои стрингове от input.

Условие:

1.Furniture

Write a function to calculate the total cost of different types of furniture. You will be given some lines of input until you receive the line "Purchase". For the line to be valid it should be in the following format:

">>{furniture name}<<{price}!{quantity}"

The price can be floating point number or whole number. Store the names of the furniture and the total price. At the end print the each bought furniture on separate line in the format:

"Bought furniture:

{1st name}

{2nd name}

…"

And on the last line print the following: "Total money spend: {spend money}" formatted to the second decimal point.

Examples

Input

Output

Comment

>>Sofa<<312.23!3

>>TV<<300!5

>Invalid<<!5

Purchase

 

Bought furniture:

Sofa

TV

Total money spend: 2436.69

Only the Sofa and the TV are valid, for each of them we multiply the price by the quantity and print the result

 

0
JavaScript Fundamentals
mobdropc avatar mobdropc 1 Точки

Mobdro pc est une application de streaming en ligne gratuite, qui permet aux utilisateurs de regarder des vidéos, des films, des émissions de télévision, des sports et bien plus encore.

Êtes-vous à la recherche de l’une des applications de streaming de films et d’émissions de télévision en ligne les plus populaires? Ensuite, vous êtes au bon endroit.

0
ZOROBOY avatar ZOROBOY 6 Точки

Решението ти е Ок, с две малки корекции:

1 - махни глобалния флаг от RegEx pattern-a - така ще извлича по един резултат от дадена линия и няма да гърми.

2  - сложи на последния console.log(`Total money spend: ${totalMoney}`); едно форматиране до 2-я знак - ...totalMoney.toFixed(2)...

 

и взимаш 100/100 ;)

0
onlinezoom avatar onlinezoom 2 Точки

 The Australian squad is expected to arrive in England before travelling to Derbyshire. From there the team will be transferred to Ages Bowl in Southamptom after England’s last test match against Pakistan.

Australia vs england matches 2020

0
lucyengelman avatar lucyengelman 0 Точки

Subway is one of those eatery networks offering a wide scope of submarine sandwiches, doughnuts, Subway Wraps, newly heated biscuits and much more global.subway.com. Anyway, do you love to need sandwiches and plates of mixed greens at Subway? On the off chance that indeed, at that point Subway is giving you a superb chance to impart your insights and criticism.

0
StJimmyyy avatar StJimmyyy 3 Точки

Ето едно решение от мен. Не е най-доброто но се надявам да помогне. https://pastebin.com/KbrDDsZq

0
08/09/2020 18:20:31