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

Write an application that asks a user to type an odd number to continue or to ty

ID: 3923688 • Letter: W

Question

Write an application that asks a user to type an odd number to continue or to type 999 to stop. When the user types an odd number, display the message "Good job!" and then ask for another input. When the user types an even number, display an error message and then ask for another input. When the user types 999, end the program. Save the file as OddEntryLoop.java. Again, Don't lot get to create the application/projects EvenEntryLoop Test.java Class that has the main method and an object to use the EvenEntryLoop class

Explanation / Answer

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package chegg;

import java.util.Scanner;


public class OddEntryLoop {
  
public void execute()
{
Scanner input = new Scanner(System.in);
int num = 0;
  
while(true)
{
System.out.println("Input a number or enter 999 to exit.");
num = input.nextInt();
if(num==999)
break;
else if(num%2==1)
System.out.println("Good job!");
else if(num%2==0)
System.out.println("Error Message!");
}
  
System.exit(0);
}
  
}

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package chegg;


public class OddEntryLoopTest {
  
public static void main(String[] args)
{
OddEntryLoop o = new OddEntryLoop();
o.execute();
}
}

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