Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have been given the beginnings of an application. The main method has already

ID: 3616223 • Letter: I

Question

I have been given the beginnings of an application. The main method has already been created as well as an examplemethod. I am to add a method that is different from theexample and add a line to the main method to test the newlycreated method.  I am supposed to use one of thesuggestions below in the method and comment the code providinga description of what the method does.

o Logical operators, Nested if statements, ComparingString objects, Conditional Operators, switch statement, Randomclass, DecimalFormat class, Increments, Decrements, while loops,do-while loop, for loop, Nested loops, break, File input/output

• Starting point:
===================================================================
public class DiscussionTwo {
public static void main(String[] args) {
  //Added by Claude Brooks
  //Constructor for all non-static methods in this classfile.
  //dissOne can be called for any other methods added tothis class.
  //No need to add another constructor.
  //Page 139 discusses constructors
  DiscussionTwo dissTwo = new DiscussionTwo();
  //Example call to method displaying odd numbers between1 and 10
  dissTwo.showOddNumbers(10);
  //End of code by Claude Brooks
}
/**

    * Added by Claude Brooks
* This displays odd numbers between 1 and the passedin number
*/

public void showOddNumbers(int myNum) {
         //For loop thatloops through myNum times
        //Pages 266-274
       for(int x = 1;x < myNum;x++) {
               //if statement that checks the remainder
              //if the remainder is 1 then the number is odd
             //Pages 169-178
             if(x % 2 == 1) {
                       System.out.println(x);
             }
      }
}

}

Explanation / Answer

please rate - thanks public class DiscussionTwo {    public static void main(String[] args) { //Added by Claude Brooks //Constructor for all non-static methods in this classfile. //dissOne can be called for any other methods added to thisclass. //No need to add another constructor. //Page 139 discusses constructors DiscussionTwo dissTwo = new DiscussionTwo(); //Example call to method displaying odd numbers between 1and 10 dissTwo.showOddNumbers(10);     //End of code by Claude Brooks dissTwo.factor(10); dissTwo.factor(17);    }    /**     * Added by Claude Brooks     * This displays odd numbers between 1 and thepassed in number     */ public void showOddNumbers(int myNum) {          //For loop thatloops through myNum times         //Pages 266-274        for(int x = 1;x
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote