Beginner Java Programming (boolean, do/while loops, for loops, if/else loops)

A prime number is a positive integer greater than 1 that is divisible only by itself and 1. In this assignment, you are responsible for writing a complete Java program to display first N prime numbers. In other words, your program should list the first N prime numbers.

Functional Requirements

Your program should prompt the user for a positive number, or a value of -1 to terminate the program. If the user enters 0, or a negative number, the program will also end immediately.
Your program will display the first N prime numbers given by the user. For example, if the user enters 3, the program should display: “2, 3, 5” which are the first three prime numbers. If the user enters 6, the output would be: “2, 3, 5, 7, 11, 13”.

Sample Run

Welcome to the list of N prime numbers program!
Please enter the value of N (positive integer):

First 6 prime numbers are:

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now