Interested in a PLAGIARISM-FREE paper based on these particular instructions?...with 100% confidentiality?

Order Now

Note: Write (or copy/paste) your answers in this document. 1)How many objects will be created by this program? Which constructors will be called and how many times each? (2 marks) class Student { public: int id; float gpa; Student() { // initialization code here } //other members here }; class BITStudent : public Student { public: int alg_id; BITStudent() { // initialization code here } //other members here }; voidmain() { BITStudent imd_y2[100]; Student* p1; Student* p2 = new Student(); }   2) Library System(Console Application) (10 marks) Consider thefollowing simple library system (code below). a) Add a User class with following members: • An int id • An array of book_id with size 8 (can borrow up to 8 books). Initially array data is set to -1 Index 0 1 2 3 4 5 6 7 Value -1 -1 -1 -1 -1 -1 -1 -1 • A function named Borrow that adds a book id(given as parameter) to the array. For example, borrowing the books with id 5, 8 and 10 will result in: Index 0 1 2 3 4 5 6 7 Value 5 8 10 -1 -1 -1 -1 -1 • A function named Return that finds a book id (given as parameter) in the array and removes it. For example, following is the result of calling Return(8). Note that 8 is removed by shifting everything after it to the left. Index 0 1 2 3 4 5 6 7 Value 5 10 -1 -1 -1 -1 -1 -1 • Any other member that is needed b) Modify the main() so that it • has an array for users with id values initialized to the array index (same as books). • asks for the user id as well, and borrows the book only if it is available and user has not reached maximum number of borrowed books. • saves the book information for the user classBook { public: int id; int borrower; Book() { borrower =-1; } void Borrow(intuserid) { borrower =userid; } void Return() { borrower =-1; } }; void main() { Book books[50]; for(int i =0; i <50; i++) books[i].id = i; while(true) { int action; printf("enter 1 to borrow, 2 to return: "); scanf_s("%d",&action); int b; printf("enter book id (0-49): "); scanf_s("%d",&b); //process if(action ==1)//borrow { if(books[b].borrower ==-1) { books[b].Borrow(u); } } else//return { books[b].Return(); } } }   3) Image Class: Computer Vision (Allegro Application) (10 marks) Computer Vision is the process of analyzing input images to detect, track, recognize, and react to objects. Edge Detection is a common task in computer vision where the program detects the boundary of an object. This boundary is then used to identify the shape of the object and eventually recognize the object. Consider the Imager class in Module 3. Create a new class based on Imager called Imager2 with three new functions: • Gray. Convert image to gray scale assuming the image is colour (RGB values are equal) • BW. Convert image to black-and-whiteassuming image is gray (pixels turn to black if gray value less than 100, otherwise white) • Edge. Detect edge points as pixels that are different from their neighbours, and then set them as black. Other pixels turn to white. Assuming the image is black-and-white.

Note: Write (or copy/paste) your answers in this document.

 

1)How many objects will be created by this program? Which constructors will be called and how many times each?

(2 marks)

class Student

{

public:

int id;

float gpa;

Student()

{

// initialization code here

}

//other members here

};

class BITStudent : public Student

{

public:

int alg_id;

BITStudent()

{

// initialization code here

}

//other members here

};

voidmain()

{

BITStudent imd_y2[100];

Student* p1;

Student* p2 = new Student();

}


 

2) Library System(Console Application)                                                   (10 marks)       

Consider thefollowing simple library system (code below).

  1. Add a User class with following members:
    • An int id
    • An array of book_id with size 8 (can borrow up to 8 books). Initially array data is set to -1

 

Index 0 1 2 3 4 5 6 7
Value -1 -1 -1 -1 -1 -1 -1 -1

 

  • A function named Borrow that adds a book id(given as parameter) to the array. For example, borrowing the books with id 5, 8 and 10 will result in:

 

Index 0 1 2 3 4 5 6 7
Value 5 8 10 -1 -1 -1 -1 -1

 

  • A function named Return that finds a book id (given as parameter) in the array and removes it. For example, following is the result of calling Return(8). Note that 8 is removed by shifting everything after it to the left.

 

Index 0 1 2 3 4 5 6 7
Value 5 10 -1 -1 -1 -1 -1 -1

 

  • Any other member that is needed
  1. Modify the main() so that it
    • has an array for users with id values initialized to the array index (same as books).
    • asks for the user id as well, and borrows the book only if it is available and user has not reached maximum number of borrowed books.
    • saves the book information for the user

 

classBook

{

public:

int id;

int borrower;

 

Book()

{

borrower =-1;

}

void Borrow(intuserid)

{

borrower =userid;

}

void Return()

{

borrower =-1;

}

};

 

 

void main()

{

Book books[50];

for(int i =0; i <50; i++)

books[i].id = i;

 

while(true)

{

int action;

printf(“enter 1 to borrow, 2 to return: “);

scanf_s(“%d”,&action);

 

int b;

printf(“enter book id (0-49): “);

scanf_s(“%d”,&b);

 

//process

if(action ==1)//borrow

{

if(books[b].borrower ==-1)

{

books[b].Borrow(u);

}

}

else//return

{

books[b].Return();

}

}

}

 

 


 

3) Image Class: Computer Vision (Allegro Application)                         (10 marks)       

Computer Vision is the process of analyzing input images to detect, track, recognize, and react to objects. Edge Detection is a common task in computer vision where the program detects the boundary of an object. This boundary is then used to identify the shape of the object and eventually recognize the object.

 

Consider the Imager class in Module 3. Create a new class based on Imager called Imager2 with three new functions:

 

  • Convert image to gray scale assuming the image is colour (RGB values are equal)
  • Convert image to black-and-whiteassuming image is gray (pixels turn to black if gray value less than 100, otherwise white)
  • Detect edge points as pixels that are different from their neighbours, and then set them as black. Other pixels turn to white. Assuming the image is black-and-white.

 

 

 

 

Interested in a PLAGIARISM-FREE paper based on these particular instructions?...with 100% confidentiality?

Order Now