subject

A customer wants to buy a pair of jeans, a pair of shoes, a skirt, and a top but has a limited budget in dollars. Given different pricing options for each product, determine how many options our customer has to buy 1 of each product. You cannot spend more money than the budgeted amount. Example priceOfJeans = [2, 3] priceOfShoes = [4] priceOfSkirts = [2, 3] priceOfTops = [1, 2] budgeted = 10 The customer 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], [2, 2, 1), (3, 2, 1), (2, 3, 1]. There are 4 ways the customer can purchase all 4 items. Function Description Complete the getNumberOfOptions function in the editor below. The function must return an integer which represents the number of options present to buy the four items. getNumberOfOptions has 5 parameters: int[] priceOfJeans: An integer array, which contains the prices of the pairs of jeans available. int[] priceOfShoes: An integer array, which contains the prices of the pairs of shoes available. int[] priceOfSkirts: An integer array, which contains the prices of the skirts available. int[] priceOfTops: An integer array, which contains the prices of the tops available. int dollars: the total number of dollars available to shop with. Constraints 1 sa, b, c, d < 103 1 s dollars < 109 1 s price of each item < 109 Note: a, b, c and d are the sizes of the four price arrays

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
What role do chromosomes play in inheritance?
Answers: 1
question
Computers and Technology, 22.06.2019 13:00
We as humans write math expression in infix notation, e.g. 5 + 2 (the operators are written in-between the operands). in a computer’s language, however, it is preferred to have the operators on the right side of the operands, i.e. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix.write a program that takes an “infix” expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % (example infix expression: (7 - 3) / (2 + 2)postfix expression: 7 3 - 2 2 + /result: 1guidelines: 1. you will need to use stacks in three placesa. one for the parenthesis check [char stack]b. one during infix to postfix [char stack]c. one during evaluation [int stack]for a and b above, you can use same array and same push, pop method as both ofthem are char. but for evaluation you have int stack and you might consider to createanother push pop method to handle it. maybe push_int, pop_int, etc. or find otherstrategy to utilize existing push pop method2. you can create a function for obtaining operator priority. that function should take anoperator as input and return its priority as an integer. this function will you a lot andreduce repeated code3. during evaluation you will need to convert char into integer. example for single digit: char c = '5'; int x = c - '0';
Answers: 2
question
Computers and Technology, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
question
Computers and Technology, 23.06.2019 06:00
Which statistical function in a spreadsheet you to see how far each number varies, on average, from the average value of the list?
Answers: 2
You know the right answer?
A customer wants to buy a pair of jeans, a pair of shoes, a skirt, and a top but has a limited budge...
Questions
question
Mathematics, 03.12.2019 01:31
question
Mathematics, 03.12.2019 01:31
Questions on the website: 13722360