Cody

Problem 46654. Inequalities

Solution 3039712

Submitted on 2 Oct 2020 by JB
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
inequality = '2x + 3y >= 24'; point = [0, 0] y_correct = 0; assert(isequal(checkPoint(inequality, point),y_correct))

point = 0 0 new = "2*0 + 3*0 >= 24" y = logical 0

2   Pass
inequality = '2x + 3y >= 24'; point = [0, 8] y_correct = 1; assert(isequal(checkPoint(inequality, point),y_correct))

point = 0 8 new = "2*0 + 3*8 >= 24" y = logical 1

3   Pass
inequality = 'x + 7y > 84'; point = [0, 12] y_correct = 0; assert(isequal(checkPoint(inequality, point),y_correct))

point = 0 12 new = "0 + 7*12 > 84" y = logical 0

4   Pass
inequality = 'x + y < -5'; point = [-5, 0] y_correct = 0; assert(isequal(checkPoint(inequality, point),y_correct))

point = -5 0 new = "-5 + 0 < -5" y = logical 0

5   Pass
inequality = '-x + y < -5'; point = [1, -10] y_correct = 1; assert(isequal(checkPoint(inequality, point),y_correct))

point = 1 -10 new = "-1 + -10 < -5" y = logical 1

6   Pass
inequality = '-9x - 8y <= -15'; point = [0, 0] y_correct = 0; assert(isequal(checkPoint(inequality, point),y_correct))

point = 0 0 new = "-9*0 - 8*0 <= -15" y = logical 0

7   Pass
inequality = '1/2x - 8/7y <= 9/8'; point = [0, 0] y_correct = 1; assert(isequal(checkPoint(inequality, point),y_correct))

point = 0 0 new = "1/2*0 - 8/7*0 <= 9/8" y = logical 1

8   Pass
inequality = '0.875x - y > 15.75'; point = [50, -90] y_correct = 1; assert(isequal(checkPoint(inequality, point),y_correct))

point = 50 -90 new = "0.875*50 - -90 > 15.75" y = logical 1

9   Pass
inequality = '8/7y <= 9/8'; point = [0, 70] y_correct = 0; assert(isequal(checkPoint(inequality, point),y_correct))

point = 0 70 new = "8/7*70 <= 9/8" y = logical 0

10   Pass
inequality = '9x <= 80'; point = [0, 7] y_correct = 1; assert(isequal(checkPoint(inequality, point),y_correct))

point = 0 7 new = "9*0 <= 80" y = logical 1

11   Pass
inequality = '5x + 4y <= 60'; for idx = 1:20 point = randi([-50, 50],1,2); y_correct = 5*point(1) + 4*point(2) <= 60; assert(isequal(checkPoint(inequality, point),y_correct)) end

new = "5*10 + 4*-32 <= 60" y = logical 1 new = "5*8 + 4*47 <= 60" y = logical 0 new = "5*-7 + 4*42 <= 60" y = logical 0 new = "5*-48 + 4*8 <= 60" y = logical 1 new = "5*16 + 4*21 <= 60" y = logical 0 new = "5*38 + 4*32 <= 60" y = logical 0 new = "5*0 + 4*31 <= 60" y = logical 0 new = "5*48 + 4*41 <= 60" y = logical 0 new = "5*-41 + 4*-38 <= 60" y = logical 1 new = "5*-8 + 4*38 <= 60" y = logical 0 new = "5*-13 + 4*-17 <= 60" y = logical 1 new = "5*-15 + 4*-9 <= 60" y = logical 1 new = "5*-12 + 4*25 <= 60" y = logical 1 new = "5*3 + 4*-32 <= 60" y = logical 1 new = "5*30 + 4*-25 <= 60" y = logical 1 new = "5*15 + 4*42 <= 60" y = logical 0 new = "5*20 + 4*33 <= 60" y = logical 0 new = "5*14 + 4*33 <= 60" y = logical 0 new = "5*-27 + 4*27 <= 60" y = logical 1 new = "5*-6 + 4*-17 <= 60" y = logical 1