(Solved): PLEASE HELP COMPLETING THIS IN JAVA!!! package *; import java.util.Scanner; public class * { pu ...

package *;

import java.util.Scanner;

public class *
{
public static void main(String [] args)
{
Scanner kb = new Scanner(System.in);
int choice=3, theNum, copy, x, y, counter, even, odd, zero;

/**
You are NOT allowed to declare additonal variables

*/

System.out.print("Please enter a positive number ");
theNum = Integer.parseInt(kb.nextLine());

// use a while loop to ensure theNum is greater than 0
// Your code goes below to the the do

do
{
do
{

System.out.println();
System.out.println("1) Enter a new number");
System.out.println("2) Print the number of even, odd and zeros in theNum");
System.out.println("3) Print the prime numbers from 2 up to and possibly including theNum");
System.out.println("4) Quit");
System.out.print("Choice --> ");
choice = Integer.parseInt(kb.nextLine());
} while(choice < 1 || choice > 4);

switch(choice)
{
case 1: // read a new positive theNum
// Your code goes below to the break

break;

case 2: // make a copy of theNum copy = theNum;
// using a loop display the number of even values, odd values
// and values that are zero in the copy of the number
// 1230 has 2 odds, 1 even and 1 zero
// Your code goes below to the break
break;

case 3: // using nested for loops print the prime numbers
// from 2 up to and possibly including theNum
// Your code goes below to the break
if (theNum == 2)
System.out.printf("Primes from %d to %d are: ", 2, theNum);
else
copy = theNum;
for(x = 4; x <= theNum; x++);

{
counter = 0;
for (y = 3; y>x && counter != 0; y++)
{
if(x % y == 0)
counter ++;
}

if(counter == 0)
System.out.print(x);
}

break;

default: System.out.println("Good Bye");

}// switch end

}while(choice != 4);

}// main end

}// class end

We have an Answer from Expert