Part 1:

In your program, write a method that accepts a positive integer and returns true if the number is a prime number and false otherwise. Note that 2 is the only even prime number. An odd integer is prime if it not divisible by any odd integer less than or equal to the square root of the number.

Part2:

A prime number whose reversal is also a prime number is called emirp. For example, 11, 13, 79 and 359 are emirps. Write a method that returns the reversal of a positive number. You can reverse the integer in the following way:

· Convert the integer into a string

value = num.ToString();

· Use the following code to reverse the integer

string newNum = “”;

for (int l = value.Length; l > 0; l--)

newNum = newNum + value[l-1];

Write a program that displays a menu with the following options:

1. The user can enter a number in an input box and the program will tell the user if the number is prime and, if so, if it is also an emirp.

2. The user can enter a number in an input box and the program will display in a listbox all the prime number and all the emirp numbers from 1 to that number.

3. The user can enter a filename that contains a list of numbers and the program will display all prime number and all emirp numbers in the file and display the results in the listbox.

4. Quit the program.

Add the following comments to the beginning of the program.

Name: Your Name

Class and Section: CS 165 01

Assignment: Final Project

Due Date: See above

Date Turned in:

Program Description: You write a short description of what the program will do

When you complete the program, do the following.

1. Turn in a printout of the source code with this sheet attached to the front

2. Create a folder with the following name: FinalProject

3. Copy your project to this folder

Copy the folder to the following location: I:\kopp\inbox\CS 165 01\your name where your name is a folder located in I:\kopp\inbox\CS 165 01. 

    • 7 years ago
    CS 165 01 Final Project
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      FinalProject.docx
    • attachment
      FinalProject.zip