Menu

(Solved) : Please Help Package Tester Public Class Examplemethods Instructions Students Use Main Met Q43942159 . . .

Please help me.

package tester;

public class ExampleMethods {

   /*
   * Instructions for students: Use the main method onlyto make calls to the
   * other methods and to print some testing results. Thecorrect operation of
   * your methods should not depend in any way on thecode in main.
   *
   * Do not do any printing within the method bodies,except the main method.
   *
   * Leave your testing code in main — you will begraded on this. You can remove
   * this comment from your submission.
   */

   /**
   * In main, write code that exercises all the methodsyou write. This code
   * should call the methods with different arguments andprint out results. You
   * should think about different arguments to try thattests different cases. For
   * example, if the method returns a true or false,write code that creates a
   * true result and other code that produces a falseresult. Use print statements
   * to explain what each test is checking and the resultthat was obtained. The
   * assignment gives a small example of this. Runningthis program should output
   * a small report on examples of using the differentmethods.
   *
   * Replace this comment with your own Javadoccomment
   */
   public static void main(String[] args) {
       // Add tests here
      
   }

   /**
   * Returns a string literal “negative” if the parameteris less than zero and
   * returns the string literal “non-negative” if thevalue is greater than or
   * equal to zero.
   *
   * For example, the method call describeSignOfNumber(7)should return
   * “non-negative”.
   *
   * You should use an if statement.
   *
   * You must return these strings exactly (all lowercase letters, spelled
   * correctly, no extra spaces). Also note that thedouble quotes are used to
   * denote a string literal, they do not appear in theactual string.
   *
   * Do not print the string return value.
   *
   * Replace this comment with your own Javadoccomment
   *
   */
   public static String describeSignOfNumber(int value){
       return “”; // Replace this linewith your own code.
      
   }

   /**
   * Returns a string literal “negative” if the parameteris less than zero,
   * “zero” if the parameter is zero, and “positive” ifthe number is greater than
   * zero.
   *
   * For example, the method call classifyNumber(7)should return “positive”.
   *
   * You must return these strings exactly (all lowercase letters, spelled
   * correctly, no extra spaces). Also note that thedouble quotes are used to
   * denote a string literal, they do not appear in theactual string.
   *
   * Do not print the string return value.
   *
   * Replace this comment with your own Javadoccomment
   *
   */
   public static String classifyNumber(int value) {
       return “”; // Replace this linewith your own code.
   }

   /**
   * Returns true if the value parameter is evenlydivisible by 7 and false
   * otherwise.
   *
   * For example, the method callisEvenlyDivisibleBySeven(14) should return true.
   * The method call isEvenlyDivisibleBySeven(16) shouldreturn false.
   *
   * You will want to use the modulus operator %, whichevaluates to the remainder
   * of x/y. When the remainder is 0, x is evenlydivisible by y.
   *
   * A starting point for learning about modulus is
   *https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/what-is-modular-arithmetic
   *
   * Replace this comment with your own Javadoccomment
   */
   public static boolean isEvenlyDivisibleBySeven(intvalue) {
       return false; // Replace this linewith your own code.
   }

   /**
   * Returns the larger of the two parameter values. Forexample,
   * chooseLargest(10.0, 100.0) should return 100.0. Youmust use an if statement
   * and not some kind of built in Java maxfunction.
   *
   * Replace this comment with your own Javadoccomment
   */
   public static double chooseLargest(double number1,double number2) {
       return 0.0; // Replace this linewith your own code.
   }

   /**
   * This method takes the start number and doubles it(times 2) while the number
   * is less than or equal to 100. As soon as it isbigger than 100, that value is
   * returned.
   *
   * For example, firstDoublingPastOneHundred(5) wouldreturn 160. The internal
   * sequence of numbers produced would be 5, 10, 20, 40,80, 160.
   * The input parameter must be a positive number. Youdo not need to check this.
   *
   * Replace this comment with your own Javadoccomment
   */
   public static int firstDoublingPastOneHundred(intstartNumber) {
       return 0; // Replace this line withyour own code.
   }

   /**
   * Given a String sentence, returns a String made ofevery other letter from
   * sentence, starting with the first character. If thesentence is the empty
   * string, return the empty string.
   *
   * For example, everyOtherLetter(“David is cool”) wouldreturn “Dvdi ol”.
   *
   * Replace this comment with your own Javadoccomment
   */
   public static String everyOtherLetter(String sentence){
       return “”; // Replace this linewith your own code.
   }

   /**
   * Produces a String starting and ending with the edgecharacter and having the
   * inner char repeated in-between. The total number ofcharacters in the string
   * is width. As an example makeLine(‘+’, ‘-‘, 8) wouldreturn the string
   * “+——+”.
   *
   * NOTE: This method is already completely implementedand must not be modified
   * for the assignment.
   *
   * @param edge The character used at the start and endof the returned string.
   * @param inner The character repeated in-between theedge char.
   * @param width The total number of characters in thereturned string. Width
   * must be greater or equal to 2.
   * @return A string with width characters.
   */
   public static String makeLine(char edge, char inner,int width) {
       String line = “”;
       int currentLocation = 0;
       // Make the middle part of the linefirst.
       while (currentLocation < width -2) {
           line = line +inner;
           currentLocation= currentLocation + 1;
       }
       // Add in the start and endcharacter to the line.
       return edge + line + edge;
   }

   /**
   * Returns a string which, when printed out, will be asquare shaped like this,
   * but of varying size (note – even though there arethe same number of
   * characters side-to-side as up-and-down, the way textis drawn makes this look
   * not like a square. We will consider it asquare.):
   *
   * <pre>
   * +—–+
   * | |
   * | |
   * | |
   * | |
   * | |
   * +—–+
   * </pre>
   *
   * The returned string should consist of width lines,each ending with a
   * newline. In addition to the newline, the first andlast lines should begin
   * and end with ‘+’ and should contain width-2 ‘-‘symbols. In addition to the
   * newline, the other lines should begin and end with’|’ and should contain
   * width-2 spaces.
   *
   * A newline is a special character use to force onestring to be on multiple
   * lines. System.out.println(“HinThere”); will produceoutput like Hi There
   *
   * The ‘n’ character is a newline.
   *
   * The method does not print anything.
   *
   * The width parameter must be greater than or equal to2.
   *
   * IMPLEMENTATION NOTE: For full credit (and for easierimplementation), make
   * use of the makeLine method provided above in yourimplementation of
   * makeRectangle. You’ll need to use a loop to callmakeLine the correct number
   * of times.
   *
   * Replace this comment with your own Javadoccomment
   */
   public static String makeSquare(int width) {
       return “”; // Replace this linewith your own code.
   }
}

Expert Answer


Answer to Please help me. package tester; public class ExampleMethods { /* * Instructions for students: Use the main method only t…

OR