Answered step by step
Verified Expert Solution
Question
1 Approved Answer
defensive porogramming question: 1. Did Susie use Design By Contract or Defensive Programming? Explain your answer and be specific. 2. The current output shows that
defensive porogramming question:
1. Did Susie use Design By Contract or Defensive Programming? Explain your answer and be specific. 2. The current output shows that the program emphasizes robustness over correctness. If the developer wanted to emphasize correctness, then what would you expect the output to be?
Programming Safely. Review the code segment & output, and then answer the question. has only positive cartesian coordinates in the range 0 to XMAX and 0 to YMAX * public interface IPixel ( static final int XMAX = 2048; tatic final int YMAX-1536; // movePixel moves the location of the pixel to the place indicated by x and y // x and y should be in the range 0 to XMAX or 0 to YMAX for x and y respectively // ?f the pixel cann t be moved t this ? cati n then it is not moved. !Pixel movePixel (int x, ?nt y) throws InvalidParameterException; Susie Q wrote a Java class that implements the IPixel interface. You wrote a test program yourself that 1) creates a pixel with a random starting point, 2) asks the user for input, and 3) invokes these 2 methods and prints out results. Below is a trace of what happened when you used Susie's implementation in your test progranm SUSIE's OUTPUT Main: your starting pixel was created. Please enter an x value for MOVE: 5 Please enter a y value for MOVE:7 ***The new pixel location is (5, 7) Please enter an x value for MOVE 15 Please enter a y value for MOVE: 12 The new pixel location is (20, 0) Programming Safely. Review the code segment & output, and then answer the question. has only positive cartesian coordinates in the range 0 to XMAX and 0 to YMAX * public interface IPixel ( static final int XMAX = 2048; tatic final int YMAX-1536; // movePixel moves the location of the pixel to the place indicated by x and y // x and y should be in the range 0 to XMAX or 0 to YMAX for x and y respectively // ?f the pixel cann t be moved t this ? cati n then it is not moved. !Pixel movePixel (int x, ?nt y) throws InvalidParameterException; Susie Q wrote a Java class that implements the IPixel interface. You wrote a test program yourself that 1) creates a pixel with a random starting point, 2) asks the user for input, and 3) invokes these 2 methods and prints out results. Below is a trace of what happened when you used Susie's implementation in your test progranm SUSIE's OUTPUT Main: your starting pixel was created. Please enter an x value for MOVE: 5 Please enter a y value for MOVE:7 ***The new pixel location is (5, 7) Please enter an x value for MOVE 15 Please enter a y value for MOVE: 12 The new pixel location is (20, 0)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started