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

  Design and implement your version in java

Pick any Array-based list in the readings from week (e.g. ArrayStack, FastArrayStack, ArrayQueue ...) and design and implement your version in Java.

  Method that returns the user entered number

write a java program that continues to prompt the user to input a real number. if the number is positive, the program calculates and outputs the area of circle using the inputted number as a radius. If the number is negative, the program exits.

  Javascript validation - cgi program

CGI mailer script form-mail.pl to your server's cgi-bin directory, and change the permissions on the script to make it executable - BMIS 310

  Calculate the total hours of over lapping meetings

Suppose you have a meeting room which can hold multiple meetings and the smalled duration of meeting can be 30 mins. Calculate the total hours of over lapping meetings.

  Creates a professorraing class consisting of professor ID

Write a program that creates a professorRaing class consisting of professor ID and three ratings. The three ratings are used to evaluate easiness, helpfullness, and clarity. In a separate implementation class, allow the user to enter the values.

  Write java program that display a welcoming message

Write a complete Java program with the following specifications: Display a welcoming message such as: "Welcome to Cubing Program!" Prompt the user twice to enter two positive whole numbers, indicating starting and finishing values, first one being s..

  Create a program that shows how android networking works

Create a program that shows how Android networking (URL, SMS, RSS) works, display the results of the program run on the emulator, and please capture screenshots of the program and emulater.

  When you declare the variable before the block begins

In order to use a variable both with a try or catch block and afterward, you must declare the variable before the __________ block begins.

  Discuss how using arrays changes the way

Discuss how using arrays changes the way that your code is organized.

  Square with a rectangle of the same size

Write a Java statement to initialize a variable square with a rectangle object whose top left corner is (10, 20) and whose sides all have length 40. Then write a statement that replaces square with a rectangle of the same size and top left corner ..

  Write a program in java for searching of an item

Write a program in java for searching of an item in a list of n numbers using linear search.

  Create a class called arrays

Create a class called Lab8. Use the same setup for setting up your class and main method as you did for the previous assignments. Be sure to name your file

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