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

Hello, Please help write program in JAVA PROGRAM SHOULD DO THE FOLLOWING: 1) Ask

ID: 3812924 • Letter: H

Question

Hello,

Please help write program in JAVA

PROGRAM SHOULD DO THE FOLLOWING:

1) Asks the user to enter a positive integer greater than 0

2) Validates that the entry is a positive integer

3) Outputs the digits in reverse order with a space separating the digits

4) Outputs the even digits not in reverse order with a space separating the digits (consider zero to be even)

5) Outputs the odd digits not in reverse order with a space separating the digits

6) Allows user is to repeat/continue the program as many times as he/she wants

7) Keeps a record in a txt file named outDataFile.txt with the history of all numbers entered and the associated results, in the following format:

the original number is 1023

the number reversed 3 2 0 1

the even digits are 0 2

the odd digits are 1 3

SPECIFIC REQUIREMENTS:

The program must have the following four void methods:

validate //validate user input

reverse // output reverse digits to screen and txt file

even //output even digits to screen and txt file

odd //output odd digits to screen and txt file

SUGGESTION from Professor:

To make the validate method return a string as follow:

public static String validate (String userAnswer);

Then do it.

However, the odd, even and reverse methods must be void.

BELOW ARE THE SCREENSHOTS OF WORKING PROGRAM:

an integer and press

Explanation / Answer

public class number {

publich static void main(0

{

int num;

int reverse;

system.out.println("enter positive number");

if(num > 0)

{

system.out.println("the original number is" +num);

}

else

{

system.out.println("invalid entry , try again");

}

}

fuction evennumber

{

while(num !=0)

{

for (int i =0;i<num.length();i++)

{

int digit = num%10;

if(digit /2 ==0)

{

system.out.println("even digit" +digit);

}

else

{

system.out.println("odd digits" +digit);

}

}

}

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