OpenGL Assignment Help Expert
2686 Order Completed 97 % Response Time 254 Reviews Since 2012

OpenGL Assignment Help Expert

Southampton, UK

Edwin J


Ph.D. in Programming, Durham University, UK

Profession

OpenGL assignment help expert

Skills

Don’t have sleepless nights over your OpenGL assignment. I am a professional OpenGL assignment help expert giving a helping hand to students in their assignments. Over the last 8 years, I have been working with programminghomeworkhelp.com ensuring that students get better grades in their assignments. During this time I have helped thousands of students get better grades. Over this period I have been working with students my focus has been on quality, timely and affordable delivery. I give a money-back guarantee to all students I work with that if I do not deliver the assignment on time I will refund their money. If you are looking to get OpenGL homework help, contact me for quality work.

Get Free Quote


 Your Order has been sent successfully. We will contact you as soon as possible.
Error: Please try again
0 Files Selected

Creating a class in C++

#include #include #include "GreenMonkey.h" using namespace std; // Identifiers vectorcreate_troop(int size); void age_troop(vector&troop); void feed_troop(vector&troop); void engage_troop(vector&troop); void statistics_on_troop(vector troop); int main() { // Generate a troop of N monkeys vector troop = create_troop(50); for (int i = 0; i< 4; i++) age_troop(troop); for (int i = 0; i< 6; i++) feed_troop(troop); for (int i = 0; i< 8; i++) engage_troop(troop); statistics_on_troop(troop); return 0; } vectorcreate_troop(int size) { vector troop; for (int i = 0; i< size; i++) { string name = "Monkey " + i; // use a default name for the constructor GreenMonkeymonkey(1.0, 10, name); monkey.assign_age_weight(1, 10, 1.0, 100.0); monkey.assign_gender(); monkey.assign_name(monkey.getGender()); troop.push_back(monkey); } return troop; } void age_troop(vector&troop) { for (int i = 0; i&troop) { for (int i = 0; i& troop) { // select two random monkeys int i1 = rand() % (troop.size() - 1); int i2 = rand() % (troop.size() - 1); GreenMonkey monkey1 = troop[i1]; GreenMonkey monkey2 = troop[i2]; if (monkey1.getGender() == monkey2.getGender()) // same gender { if (monkey1.getAge() < monkey2.getAge()) monkey1.fight(monkey2); else if (monkey2.getAge() < monkey1.getAge()) monkey2.fight(monkey1); else { //randomize fight int r = rand() % 2 + 1; if (r == 1) // monkey 1 fight 2 monkey1.fight(monkey2); else monkey2.fight(monkey1); } } else { // mate monkeys if (!monkey1.isMutant() && !monkey2.isMutant()) { float weight = ((float)rand() / RAND_MAX) * (2.5 - 0.5) + 0.5; int mutant_chance = rand() % 100 + 1; GreenMonkeychild(0, weight, "Child"); if (mutant_chance<= 2) child.setMutant(true); } } troop[i1] = monkey1; troop[i2] = monkey2; } void statistics_on_troop(vector troop) { // count alive male monkeys older than 1 int male_alive = 0; int female_alive = 0; int mutant = 0; int monkeys_1year = 0; int male_dead = 0; int female_dead = 0; for (int i = 0; i 1) male_alive++; if (monkey.isAlive() &&monkey.getGender() == 'F' &&monkey.getAge() > 1) female_alive++; if (monkey.isMutant() &&monkey.getAge() <= 1) mutant++; if (monkey.getAge() <= 1) monkeys_1year++; if (!monkey.isAlive() &&monkey.getGender() == 'M') male_dead++; if (!monkey.isAlive() &&monkey.getGender() == 'F') male_dead++; } cout<< "Number of male alive monkeys older than 1 year: " < #include #include #include using namespace std; GreenMonkey::GreenMonkey(float weight_, int age_, string name_) { weight = weight_; age = age_; name = name_; } void GreenMonkey::print() { // Display the variables cout<< "Name: " << name < names; string file_name; if (gender == 'M') // open M_names.txt file_name = "M_names.txt"; else file_name = "F_names.txt"; ifstreammyfile(file_name); while (getline(myfile, line)) { names.push_back(line); } myfile.close(); // Now pick a name int r = rand() % (names.size() - 1); string chosen_name = names[r]; name = chosen_name; } void GreenMonkey::assign_age_weight(int minage, int maxage, int minweight, int maxweight) { int newage = rand() % maxage + minage; float newweight = rand() % maxweight + minweight; age = newage; weight = newweight; }

Design and object-oriented programming

#include #include using namespace std; class item{ string name; int id; double value; int quantity; public: string getName(){ return name; } void setId(int id){ this->id=id; } void setName(string name){ this->name=name; } void setQuantity(int quantity){ this->quantity=quantity; } int getQuantity(){ return quantity; } double getValue(){ return value; } void setValue(double value){ this->value=value; } bool isAvailable(int requested){ if(requested>quantity){ return false; } return true; } string info(){ return quantity+" "+name+" left in stock at $"+to_string(value)+" item id "+to_string(id); } }; void displayMenu(item inventory[4]){ cout<<("===Menu==="); cout<<("Enter which item you would like to purchase."); for(int i=0;i<4;i++){ cout<<((i+1)+". "+inventory[i].info()); } } int main() { item inventory[4]; int i; int itemsSold=0; string name; int id; int quantity; double value; string option; int choice; string chose; double discount; int request; cout<<("===Welcome to the inventory helper===\n"); cout<<("-store hours will begin shortly-\n"); for(i=1;i<5;i++){ cout<<"Enter item "<>name; inventory[i-1].setName(name); cout<<("Enter product manufacturer's id.\n"); cin>>id; inventory[i-1].setId(id); cout<<("Enter retail value.\n"); cin>>value; inventory[i-1].setValue(value); cout<<("Enter quantity available.\n"); cin>>quantity; inventory[i-1].setQuantity(quantity); } for(i=0;i<4;i++){ cout<>option; while(option=="y"){ if(itemsSold==2){ cout<<("\n2 items sold\n"); cout<<("Sale starting!"); cout<<("Would you like to enter a discount %?(y/n)\n"); cin>>chose; if(chose=="y"){ cout<<("Enter the custom discount percentage.\n"); cin>>discount; for(i=0;i<4;i++){ inventory[i].setValue(((inventory[i].getValue()*(1-discount)*100)/100.0)); cout<<"Price for "<>choice; choice=choice-1; cout<<("Houw many would you like to buy?\n"); cin>>request; while(!inventory[choice].isAvailable(request)){ cout<<"Not enough "<>request; } cout<<"SOLD "<>option; } cout<<("Closing shop -- inventory left\n"); for(i=0;i<4;i++){ cout<