Question: Consider writing the function named moreRedThanGreen that has one parameter named namefile, that is the name of an image. This function calculates how many pixels
Consider writing the function named moreRedThanGreen that has one parameter named namefile, that is the name of an image. This function calculates how many pixels in an image have more red than green in the pixel (that is the red number is larger than the green number).
The function moreRedThanGreen has been started for you but has missing code:
function moreRedThanGreen(namefile) { var some Img = new Simple Image (namefile); Missing Code return count; Which one of the following is the correct missing code? var count = 0; for (var pix of some Img.values()) { if (pix.getRed() > pix.getGreen() { count = count + 1; } var count = 0; for (var pix of some Img.values()) { if (pix.getRed() >= pix.getGreen()) { count = count + 1; } } for (var pix of some Img.values()) { var count = 0; if (pix.getRed() >= pix.getGreen() { count = count + 1; } } for (var pix of some Img.values()) { var count = 0; if (pix.getRed() > pix.getGreen()) { count = count + 1; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
