header.h
// Programmer: Bushra Anjum
// file: header.h
#ifndef header_h
#define header_h
# include <string>
using namespace std;
struct Bullet
{
float m_caliber;//.22, .38, .50
short m_numberOfLG;//5, 6, 7
float m_widthLand;// [0.025, 0.030]
float m_widthGroove;//[0.025, 0.030]
bool m_isMarking;// true, false
string m_name;// name with no space
};
const int SIZE = 25;
const float TOLERANCE = 0.001;
const float LOWER_LIMIT = 0.025;
const float UPPER_LIMIT = 0.030;
const float CALIBER []= {0.22, 0.38, 0.50};
const short NUMBER_OF_LG [] = {5, 6, 7};
const string VILLAIN [] = {"Joker", "Darth_Vader", "Hannibal_Lecter",
"Jack_Torrance", "Freddy_Krueger", "Magneto", "Lord_Voldemort", "Agent_Smith",
"Norman_Bates", "Hans_Gruber", "Sauron", "Palpatine", "Xenomorph", "Hans_Landa",
"Scar", "Michael_Myers", "Anton_Chigurh", "Bane", "John_Doe", "Jason_Voorhees",
"Nurse_Ratched", "Loki", "Wicked_Witch_of_the_West", "Count_Dracula", "Gollum"};
/* Description: The establishDB() function populates the bullet database.
Pre: None.
Post: Bullets in the bullet database.
*/
void establishDB(Bullet db[], const int size);
/* Description: The printDB() function outputs the bullets in the bullet database.
Pre: None.
Post: Outputs the list of bullets in the bullet database on the screen.
*/
void printDB(const Bullet db[], const int size);
/* Description: The printBullet() function outputs the information about the bullet
that is passed to it.
Pre: None.
Post: Information about bullet is output to the screen.
*/
void printBullet(const Bullet & bullet);
/* Description: The sortDB() function sorts the bullet db by caliber in increasing order.
Pre: None.
Post: The bullet db is sorted in increasing order.
*/
void sortDB(Bullet db[], const int size);
/* Description: The searchBullet() function searches the bullet db for the bullet that is passed to it.
Pre: None.
Post: Returns true if a match is found else returns false.
*/
bool searchBullet(Bullet & b, Bullet db[], const int size);
/* Description: The searchLargest38() function searches the bullet db for the bullet with the larges
groove and caliber 38.
Pre: None.
Post: Returns the bullet if found.
*/
Bullet searchLargest38(const Bullet db[], const int size);
/* Description: The getBullet() function will ask the user to input the information that decribes
a bullet and creates a bullet with the information.
Pre: None.
Post: Output several messages that asks the user to input the different information describing
a bullet.
Returns a bullet created.
*/
Bullet getBullet();
/* Description: The presentMenu() function will output available menu options to the screen.
Pre: None.
Post: Menu options output to the screen.
*/
void presentMenu();
/* Description: The goodbye() function will output a signoff message to the screen.
Pre: None.
Post: Signoff message output to the screen.
*/
void goodbye();
/* Description: The isbetween() compares two values with a given tolerance.
Pre: None.
Post: Returns true if val is equal to mid given tolerance else returns false.
*/
bool isbetween(const float val, const float mid, const float tolerance);
/* Description: The getBoolean() function will ask the user to input an answer to the question that
will be passed as parameter correctly..
Pre: None..
Post: outputs a message to the screen asking the user to input an answer to a question.
returns the user's answer.
*/
bool getBoolean(const string question);
/* Description: The getInteger() function will ask user to input an integer and validate the
input to lie between parameter min and parameter max..
Pre: parameter min must be less than parameter max..
Post: Outputs a message to the screen asking the user to input an integer that lies betwen
min and max.
Returns the valid integer input.
*/
int getInteger(const int min, const int max);
/* Description: The get_random_number() function generates a random number that lies betwen
lower_limit and upper_limit.
Pre: Parameter lower_limit must be less than parameter upper_limit.
Post: Returns a random number that lies between lower_limit and upper_limit.
*/
float get_random_number(const float lower_limit, const float upper_limit);
/* Description: The swap_bullets() function will swap the values of the arguments sent to it.
Pre: None.
Post: The values of the arguments sent will be swapped back in the calling function..
*/
void swap_bullets(Bullet &b1, Bullet &b2);
#endif