Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need this in C++ Write the definition of a class that has the following proper

ID: 3889490 • Letter: I

Question

I need this in C++

Write the definition of a class that has the following properties:

The name of the class is coderType.

The class coderType has four member variables: name (string), year (int), rank (int), and users (double).

The class coderType has the following member functions.

print - outputs data stored in the member functions

setName - function to set the name

setYear - function to set the year

setRank - function to set the rank

setUsers - function to set the users

getName - function to set the name

getYear - function to set the year

getRank - function to set the rank

getUsers - function to set the users

constructor with default parameters: name default to an empty string (" "); year, rank, and users have a default value of 0.

Explanation / Answer

Here is code:

class coderType {

public:

string name; // Length of a box

int year; // Breadth of a box

int rank; // Height of a box

double users;

// constructor

coderType(){

name = "";

year = 0;

rank = 0;

users = 0;

}

// Member functions declaration

void setName(string);

void setYear(int) // function to set the year

void setRank(int) // function to set the rank

void setUsers(double) // function to set the users

string getName() // function to set the name

int getYear() // function to set the year

int getRank() // function to set the rank

double getUsers() // function to set the users

};

// Member functions definitions

void coderType::setName(string n ){

name = n;

}

void coderType::setYear(int y){

year = y;

}

void coderType::setRank(int r ){

rank = r;

}

void coderType::setUsers(double u){

users = u;

}

string coderType::setUsers(){

return name;

}

int coderType::setUsers(){

return year;

}

int coderType::setUsers(){

return rank;

}

double coderType::setUsers(){

return users;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote