Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

Students also viewed these Databases questions

Question

1. Does the survey prompt discussions with your direct reports?

Answered: 1 week ago