ENGR 021 Fall 2014 Assignment #6

DUE: Monday, November 24, 2014 6:30 PM at Start of Class

Rules:



1. Pseudocode for Prime Numbers Within a Range


Pseudocode only!!!
As you know, a prime number is a number divisible only by 1 and itself.
There are an infinite quantity of prime numbers (an important theorem of mathematics!).
Use of prime numbers plays an important role in encryption keys for internet security.
Write an algorithm and detailed pseudocode (not the C++ program - just the pseudocode) that finds the quantity of primes, and all prime numbers within a range of positive integers that is specified by the user.
Again, we're not writing the C++ program here, just the DETAILED pseudocode.
Just to further illustrate what is happening here, if one did write the entire program (IF they did - you're not), here's how a typical run might look:


Welcome to the prime number finder.
Enter the range of interest by entering the beginning and ending numbers of the range, separated by a space, then hit Enter: 822  856

Thank you.  There are 5 prime numbers between 822 and 856, which are:
823, 827, 829, 839,and 853
Would you like to enter another range to see what primes are in that one (Y/N)? N
Thanks, good bye.


2. Triangle Class Objects, With Inheritance


In this exercise we will produce two classes.
First, a class that creates called "BASICTRIANGLE", which accepts the (x,y) coordinates of the vertices of triangles of any shape, that are input by the user.
Then, in the same program, we will write another class of triangle, a better one, that has more features, called SUPERTRIANGLE.
The second class, SUPERTRIANGLE, will be created by inheriting the properties of BASICTRIANGLE.

For The Class BASICTRIANGLE
In BASICTRIANGLE, have a constructor that asks user for three sets of integer type (x,y) coordinates (private), and immediately checks the following:
1. That the absolute value of each of the (x,y) coordinates are between 1 and 40. If not, ask for re-entry. (we don't need football-field sized triangles!)
2. That the three sets of (x,y) coordinates really make a triangle (they should not be duplicated, should not all be in a straight line, etc.).
If not, ask for re-entry.

Other member functions (in addition to constructor and destructor) will need to be included to calculate the following:
 - Length of side 1 
 - Length of side 2 
 - Length of side 3 
 - Area 
 - Perimeter 
 - Display all of a BASICTRIANGLE object's triangle information

For The Class SUPERTRIANGLE
In SUPERTRIANGLE, which inherits the attributes and properties of BASICTRIANGLE, add the following features:
 - Interior Color
 - Whether the triangle is equilateral or isosceles (E, I, or N for neither) 
 - Whether the triangle is a right triangle or not (y/n function)
 - Display all of a SUPERTRIANGLE object's triangle information

When you have good code, thoroughly test the program with a variety of triangle shapes and sizes that you make up
For example, have your test program make triangles, calculate properties, change dimension(s), calculate again, etc.
Verify with hand calculations that everything works properly.
When you are confident that it is working very accurately, turn in output for the following situations:

a. Make triangle with coordinates (3,2) (3,11) (4,13) 
b. Display all of its info 
c. Change coordinates to (1,16) (-12,2) (-3,-4) 
d. Display all of its info 
e. Make triangle with coordinates (0,0) (-9,9) (0,-11) 
f. Change its coordinates to (-7,0) (-2,0) (-2,5) 
g. Display all of its info 
h. Make up your own triangle which overlaps all quadrants but mostly lies in the 4th quadrant 
i. Display all of its info
j. Create a SUPERTRIANGLE object using the inherited class, resulting in coordinates (14,6) (21,-20) (5,-4), color blue.
k. Display all of its info
l. Leave the session, with printed verification that all triangle objects were indeed destroyed