Cody

Problem 46654. Inequalities

Solution 3263898

Submitted on 18 Oct 2020 by Nikolaos Nikolaou
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 ans = logical 0 m = logical 0

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

point = 0 8 ans = logical 1 m = logical 1

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

point = 0 12 ans = logical 0 m = logical 0

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

point = -5 0 ans = logical 0 m = logical 0

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

point = 1 -10 ans = logical 1 m = logical 1

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

point = 0 0 ans = logical 0 m = 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 ans = logical 1 m = 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 ans = logical 1 m = 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 ans = logical 0 m = logical 0

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

point = 0 7 ans = logical 1 m = 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

ans = logical 1 m = logical 1 ans = logical 1 m = logical 1 ans = logical 1 m = logical 1 ans = logical 0 m = logical 0 ans = logical 0 m = logical 0 ans = logical 1 m = logical 1 ans = logical 1 m = logical 1 ans = logical 1 m = logical 1 ans = logical 0 m = logical 0 ans = logical 1 m = logical 1 ans = logical 0 m = logical 0 ans = logical 1 m = logical 1 ans = logical 0 m = logical 0 ans = logical 1 m = logical 1 ans = logical 0 m = logical 0 ans = logical 0 m = logical 0 ans = logical 0 m = logical 0 ans = logical 1 m = logical 1 ans = logical 0 m = logical 0 ans = logical 1 m = logical 1

Suggested Problems

More from this Author72

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!