if and if-else statement:
you will have to write a program that reads a 4-digit positive integer from the user and prints out the following information on the screen:
1. Whether the positive integer is an odd or even number
2. (display) The odd digits of the integer
3. (display) The even digits of the integer
4. Whether the number reads the same forwards and backwards (e.g., 4004, 4444, etc.)
5. Whether all four digits are the same (e.g., 8888)

you will have to write a program that reads a 4-digit positive integer from the user and prints out the following information on the screen:

Re-read your project assignment. Pay particular attention to the part that I bolded.

1st Part

public void posneg (String str1)
{
Convert the string to int
Divide it by 2,
if there is a remainder, its odd
if not even
}

second part

public void numposneg (String str2)
{
see the String api, there is an api that converts
the string to a char array

call posneg
}

third part

public void numposneg (String str2)
{
see the String api, there is an api that converts
the string to a char array

compare the first and last index only
}

last part

well you should be able to compare if
both number are equal

What would you kids do without richard west doing your homework

Richard West

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.