question archive A shopaholic has to buy a pair of jeans, a pair of shoes, a skirt, and a top with budgeted dollars
Subject:StatisticsPrice:4.87 Bought11
A shopaholic has to buy a pair of jeans, a pair of shoes, a skirt, and a top with budgeted dollars. Given the quantity of each product and the price per unit, determine how many options of each item are present. If required, all budgeted dollars can be spent
Example
priceOfJeans - 12,3)
priceOfShoes = (4)
priceOfSkirts - (2, 3)
priceOfTops = [1, 2]
budgeted = 10
The shopper must buy shoes for 4 dollars since there is only one option. This leaves 6 dollars to spend on the other 3 items. Combinations of prices paid for jeans, skirts, and tops respectively that add up to 6 dollars or less are [2, 2, 2). 12. 2. 1). 13, 2, 1). [2, 3, 1). There are 4 ways the shopper can purchase all 4 items.
Function Description
Complete the getNumberofoptions function in the editor below.
getNumberOfOptions has 5 parameters:
int priceOfJeans(a): An integer array, which contains the prices of the pairs of jeans available.
int priceOfShoes(b): An integer array, which contains the prices of the pairs of shoes available.
int priceOfSkirts(c): An integer array, which contains the prices of the skirts available.
int priceortops(d): An integer array, which contains the prices of the tops available,
int budgeted the total number of dollars available to shop with. Return long: the number of options present to buy the four items Constraints
Shopper's Delight A shopaholic has to buy a pair of jeans, a pair of shoes, a skirt, and a top with budgeted dollars. Given the quantity of each product and the price per unit, determine how many options of each item are present. If required, all budgeted dollars can be spent
Example
priceOfJeans - (2,3)
priceOfShoes - (4)
priceOfSkirts = [2, 3]
priceOfTops = [1, 2]
budgeted = 10
The shopper must buy shoes for 4 dollars since there is only one option. This leaves 6 dollars to spend on the other 3 items. Combinations of prices paid for jeans, skirts, and tops respectively that add up to 6 dollars or less are (2, 223. 12, 2, 1). 13, 2, 1), (2, 3, 1). There are 4 ways the shopper can purchase all 4 items.
Function Description
Complete the getNumberOfOptions function in the editor below. getNumber of options has 5 parameters:
int priceofjeans(a): An integer array, which contains the prices of the pairs of jeans available.
int priceorShoes(b): An integer array, which contains the prices of the pairs of shoes available.
int priceofskirts[c): An integer array, which contains the prices of the skirts available,
int priceofTops(d): An integer array, which contains the prices of the tops available,
int budgeted the total number of dollars available to shop with Return long: the number of options present to buy the four items Constraints
Purchased 11 times