Cody

Problem 2267. Sales Prediction

Solution 2074552

Submitted on 30 Dec 2019 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
item_price = [10 35 2 100 99 87 1 0.5 9 30] ; total_items_shopped = [ 2 0 5 10 8 9 1 0 0 1]; shop_no = 5; avg_spending =73.22; shop_prob = 0.22 [x,y] = Shopping(item_price ,total_items_shopped, shop_no ); assert(isequal([x,y],[avg_spending, shop_prob]))

shop_prob = 0.2200 shop_prob = 0.2200 avg_spending = 73.2200

2   Pass
item_price = [10 4 22 10 5 7 2 10 95 56] ; total_items_shopped = [ 23 0 0 11 38 0 1 0 0 0]; shop_no = 7; avg_spending =7.29; shop_prob = 0.01 [x,y] = Shopping(item_price ,total_items_shopped, shop_no ); assert(isequal([x,y],[avg_spending, shop_prob]))

shop_prob = 0.0100 shop_prob = 0.0100 avg_spending = 7.2900

3   Pass
item_price = ones(1, 10) ; %dollar shoppie total_items_shopped = [ 1 0 3 4 8 9 0 5 0 10]; shop_no = 10; avg_spending = 1; shop_prob = 0.25; [x,y] = Shopping(item_price ,total_items_shopped, shop_no ); assert(isequal([x,y],[avg_spending, shop_prob]))

shop_prob = 0.2500 avg_spending = 1