CitadelOA #22
Price Check
Estimated EasyStatement and editorial — judging is being prepared
Topics (AI-labelled)Hashing
There is a shop with old-style cash registers. Rather than scanning items and pulling the price from a database, the price of each item is typed in manually. This method sometimes leads to errors. Given a list of items and their correct prices, compare the prices to those entered when each item was sold. Determine the number of errors in selling prices.
Function Description
Complete the function priceCheck in the editor.
priceCheck has the following parameter(s):
-
String[] products: eachproducts[i]is the name of an item for sale
-
float[] productPrices: eachproductPrices[i]is the price ofproducts[i]
-
String[] productSold: eachproductSold[i]is the name of a product sold
-
float[] soldPrice: eachsoldPrice[i]contains the sale price recorded forproductSold[i]Returnsint: the number of sale prices that were entered incorrectly
Constraints
1 ≤ n ≤ m1 ≤ m ≤ n|SP - productPrices[i], soldPrice[j]| ≤ 100000.00, where `0 ≤ i
Editorial
Loading solution…