Specification" 4 Look at each method Mentally classify...

This preview shows page 1 - 5 out of 19 pages.

please give me a code to me, it should be right code. sofeware: eclipe ASAP! thanks! wireless print class is class names questions very few ,ok? 0. Be sure understand the basics of defining a class as in Sections 3.1.3.3 of the text and as practiced in Lab 2 1. Create a new, empty project and add a package called hwi. 2. Create the Wireless Printer class in the hw1 package and put in stubs for all the required methods and constructors. For methods that are required to return a value, just put in a "dummy" return statement that returns zero or false. 3. Download the speechecker, import it into your project as you did in labs 1 and 2, and run it. There will be lots of error messages appearing in the console output, since you haven't actually implemented the methods yet. Always start reading from the top. All you really want to
check at this point is whether you have a missing or extra public method, if the method declarations are incorrect, or if something is really wrong like the class having the incorrect name or package Any such errors will appear first in the output and will usually say "Class does not conform to specification." 4. Look at each method. Mentally classify it as either an accessor (returns some information without modifying the object) or a mutafor (modifies the object, usually returning void). The accessors will give you a lot of hints about what instance variables you need. 5. Before you write code for a method, always write a simple usage example or test case, similar to the main method shown above. This will make sure you understand what the code is really supposed to do, and it will give later you a way to check whether you did it correctly. Of course, if you are really not sure what a method is supposed to do, bring up CAPACITY) 7. For the print() method, it should do nothing if
the printer is not connected to the network. You can achieve it by placing the following statement at the top of your print() method. public void print(int pages) { if (! isConnected()) return; // do nothing the rest of the code goes here

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture