Ebay | Need Help| Onsite
Anonymous User
835

Given a string and discount for the product -- string which has dollar amount of the product, extract the amount, apply the discount and return the string with the amount after discount applied.

This Input string can be any string.

public String getModifiedString(String s, int discount)

Example  1 : Input string : The price of the TV is $400 today, add to cart and proceed to checkout
				  discount: 10
				Output: The price of the TV is $360 today, add to cart and proceed to checkout
				
Example  1 : Input string : The price of the laptop is $300 today, the price might vary tomorrow
				  discount: 10
				Output: The price of the laptop is $270 today, the price might vary tomorrow

I was not able to solve the problem
Comments (4)