Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is my program and i need to its main.cpp amd i dont want to insert the the names and roll no but i want

this is my program and i need to its main.cpp image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
amd i dont want to insert the the names and roll no but i want its output to be like that bcz i made an a main.cpp
image text in transcribed
but i guess its wrong
4 1/and member functions, getters, setters, cons 5 7 #ifndef NODE H 8 #define NODEH g 10 11 #include 12 /ode class 13 class node 14 { 15 private: 16 //data members 17 std::string name; 18 int rollno; 19 node *next; 20 public: 21 22 //constructor 23 node(); 24 //parametrized constructor 25 node(std::string, int, node *); 26 //getters and setters 27 std::string getName(); 28 int getRollno(); 29 node* getnext(); 30 void setName(std::string); 31 void setRollno(int); 32 int distance_to_tail(node *, std::string); 33 friend std::ostream& operator 33 //setter function to set nane of student 34 void node::setName(string actual_nane) 35 36 name actual name: 37 ) 38 1/setter function to set rollno of student 39 void node::setRollno(int actual_rollno) 40 41 actual_roline rollno: 42) 43 1/function to return distance from tail of the given node 44 int node::distance_to_tail(node "head, string data) 45 ( 46 int cnt 0, len - 0:1 47 node *temp - head; 48 while (temp = NULL) 56 lent: 51 temp - tem-sext: 52 5) temp = head: 54 while (temp !NULL) 55 ( 56 if (data - temp->getName()) 571 58 cnt: 59 break; 60) 61 cnt: 62 temp = temp-text; 63 ) 29 int node::getRollno() 30 ( 31 return rollno; 32 ) 33 setter function to set name of student 34 void node::setName(string actuel_name) 35 { 36 nane - actual_name: 37 ) 38 //setter function to set rolino of student 39 void node::setRollno(int actual_rollno) 40 41 actual_rolino - rollno: 42 } 43 //function to return distance from tail of the given node 44 int node::distance_to_tail (node "head, string data) 45 46 int cnt , len = 0; 47 node *temp - head; 43 While (temp != NULL) 49 ( 50 lent: 51 temp - temp->next; 52 ) 53 temp = head; 54 while (temp != NULL) 55 { 56 if (data temp->getName()) 57 58 cnt: 59 break; 60) 61 cnt : 62 temp - temp->next; 63 64 return len . cnt: 65 66 //function to overload #include "student.h" 7 using namespace std; 8 //default and parametrized constructor Student::Student (string actual_name, int actual_rollno) 10 { 11 node *sudo = new node (actual_name, actual_rollno, NULL); 12 head = sudo; 13 tail = sudo; 9 14 } 15 //overloading getName() "" temp->getRollno() " | "getnext() getnext(); 25 } return out; 27 } 28 26 Program Specification: You have the following files student.h. student.cpp.node.h node.cpp, and main.cpp Use suitable information encapsulation techniques (ie data members should be private and a function not changing the object should be constant) Public member functions for the student class should include the following: A default constructor in which the student's name is undefined" and number is 0 A parametrized constructor in which the user specifies the two parameters for the object's data members. You may combine the default and parameterized constructor one. Feel free to ask me for clarification Getters and Setters which return and update their respective data member values Overload the William 40x61fd58 - mary 310x61078)->ade 20x61fd98-> borris. 1101 3 //main.cpp file to use student and node class 4 1/and create object of student class to store 5 #include 6 #include "student.cpp" 7 int main() 8 { Student obj ("William", 4); 10 obj. ("mary", 3); 11 obj.("ade", 2); 12 obj.("borris", 1); 13 //printing the result 14 cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

What stage of development is your industry in?

Answered: 1 week ago

Question

5. Identify and describe nine social and cultural identities.

Answered: 1 week ago

Question

2. Define identity.

Answered: 1 week ago

Question

4. Describe phases of majority identity development.

Answered: 1 week ago