Displays a corresponding comment as prime number

Assignment Help JAVA Programming
Reference no: EM132430563

Problem: Write a Java program with the following specifications:

1. The program should display a menu as follows:

 MENU

[1] Prime or Composite

[2] All Prime Numbers

[3] Exit

Choose an option à

2. Option 1 should ask for an integer from the user and displays a corresponding comment as "Prime Number", "Composite Number", or "Neither Prime nor Composite".

3. Zero and 1 are neither prime nor composite, -1 is prime, while all other negative numbers are composite.

4. Option 2 should ask for an entry of two integers. It should determine and display all prime numbers between the two integers (including the two integers, if they are prime).

For example, if 3 and 11 are entered, the display should be:

3, 5, 7, 11

5. The program returns to the main menu after each display from the option and when an invalid input of the option is encountered.

6. Validate the option input. Only 1, 2 and 3 are acceptable, otherwise, display a message error and return to the main menu.

7. Exit option terminates the program.

Reference no: EM132430563

Questions Cloud

Improve the performance of program : In a Java program that used a sequential file, how or why would would using either a random access or index sequential file improve the performance
Provide a standard three-parameter constructor : Provide a standard three-parameter constructor for a class named CellPhone. The class contains three instance variables-manufacturer, model, and price
Generate an application named studentsstanding : Generate an application named StudentsStanding.java that allows you to enter student data that consists of an ID number
Explain biopsychosocial-spiritual treatment : Briefly describe the two individuals whom you selected from the scenarios.Explain how you would apply a biopsychosocial-spiritual treatment approach
Displays a corresponding comment as prime number : Problem: Write a Java program with the following specifications: 1. The program should display a menu as follows:
Text file of strings representing numbers : Design a program that will search a text file of strings representing numbers of type int and will write the largest and the smallest numbers to the screen.
Preparing the balance sheet for the fiscal year : The following is the Frederick Company's adjusted Trial Balance. Use this information to practice preparing the Balance Sheet for the fiscal year
Discuss ways in which the world of the elderly shrinks : Some social scientists discuss the fact that the elderly live in a "shrinking world." Discuss ways in which the world of the elderly shrinks.
What is a well-documented program : What is a well-documented (commented) program, "RelativelyPrimeArray," that takes an integer command-line argument "n" and creates

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd