1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vfiekz [6]
3 years ago
14

Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the PrintAll member function and a separate cout stat

ement to output courseStudents's data. End with a newline. Sample output from the given program: Name: Smith, Age: 20, ID: 9999
Computers and Technology
2 answers:
agasfer [191]3 years ago
7 0

Answer:

Following are the program in c++

;#include <iostream> // header file

#include <string>

using namespace std;

class student // class

{

   public:

   int ID,age ; // variables

   string courseStudentsname;

   student() // constructor initialize the member

   {

     courseStudentsname="Smith";

     age=20;

     ID=9999;

   }

   void PrintAll() //PrintAll()  function

   {

cout << "Name: " <<courseStudentsname;

cout << ", Age: " << age;

cout << ", ID: " << ID;

}

};

int main() // main function

{

   student e; // create object and call default constructor

   e.PrintAll(); // call the PrintAll() function

   return 0;

}

Explanation:

In the given program we create a three variable inside the class student and declared three variable  ID,age of int type and courseStudentsname of string type after that we create  a constructor and initialize them as value is given in question and finally create a  PrintAll member function which  separate cout statement to output .In the main function create a object class student and call the PrintAll function.

Output:

Name: Smith, Age: 20, ID: 9999

Elodia [21]3 years ago
6 0

Answer:

Following are the program in the C++ Programming Language:

#include <iostream> //header file

using namespace std; //namespace

class Students //define class

{public: //access modifier

 int id,a ; //set variables

 string courseStudentsname; //set variables

 Students() //set constructor

 {

   courseStudentsname="Smith"; //initialize the value

   a=20;  //initialize the value

   id=9999; //initialize the value

   cout<<endl;

 }

 void PrintAll() //define function

 {

   cout << "Name: " <<courseStudentsname<<endl; //print output

   cout << "Age: " << a<<endl; //print output

   cout << "ID: " << id; //print output

 }

};

int main() //define main function

{

 Students obj; //set object and call constructor

 obj.PrintAll(); // call function through object

 return 0;

}

<u></u>

<u>Output</u>:

Name: smith

Age: 20

ID: 9999

Explanation:

Here, we define class "Students" inside it.

  • we define two integer type variable "a" for age of the students and "id" for the id of the students and then we set a string type variable "courseStudentsname" for name of the students.
  • we set the constructor in which we assign the value to the variables.
  • we set the function 'PrintAll()' in which we print all the variables.

Finally, we define the "main()" Function in which we create the object of the class "obj" and call the the "PrintAll()" through the object of the class.

You might be interested in
A collection of realated files is called a
Thepotemich [5.8K]

The answer to this question would be:

database/records

They all have in common the same files.

4 0
4 years ago
Who does Potholes effect in South Africa?
Morgarella [4.7K]
By definition, a pothole is a structure mostly located at the surface of roads and highways wherein it is usually characterised by having deep crevices which are primarily caused by extreme soil erosion or the presence of water in the area. In addition, these potholes greatly affect the transportation system of South Africa because the flow of traffic will be interrupted.
4 0
3 years ago
Which of the following are benefits of designing a scalable system? choose 3 options.
ollegr [7]
I asked my brother since he’s kinda of tech geek and he said

The 1st, 3rd, and 5th answers are correct

Hope this helps and I hope my brother is not wrong.
7 0
3 years ago
In the Happy Valley School System, children are classified by age as follows: less than 2, ineligible 2, toddler 3-5, early chil
sasho [114]

// C++ switch

// It can also be used for JAVA, C#

switch(age){

// here age will be sent by the function in which it is used

// case to check the age<2

case(age<2 && age>0):

// printing the line

cout<<"ineligible";

// case to check the age ==2

case(age==2):

// printing the line

cout<<"toddler";

// case to check 3-5

case(age>=3 && age<=5):

cout<<"early childhood";

// case to check 6-7

case(age==6 || age==7):

cout<<"young reader";

//case to check 8-10

case(age>=8 && age<=10):

cout<<"elementary";

// case to check 13

case(age==13):

cout<<"impossible";

//case tocheck 14-16

case(age>=14 && age<=16):

cout<<"high school";

// case to check 17 or 18

case(age==17 || age==18):

cout<<"scholar";

//case to check >18

case(age>18);

cout<<"ineligible";

// default case

default:

cout<<"Invalid age";

}

Read more on Brainly.com - brainly.com/question/12981906#readmore

5 0
3 years ago
You are a psychologist who needs to provide a qualitative evaluation for IQ scores. Create a program that takes IQ scores (one a
dsp73

Answer:

Check the explanation

Explanation:

#include <iostream>

#include <iomanip>

using namespace std;

int getIQ(); // return the score

void printEvaluation(int);

int main()

{

   int IQ = 0;

   IQ = getIQ();

   

   printEvaluation(IQ);

   return 0;

}

int getIQ()

{

   int score = 0;

   cout << "Please enter your IQ Score to receive your IQ Rating:\n";

   cin >> score;

   

   return score;

}

void printEvaluation(int aScore)

{

   cout << "IQ Score: " << aScore << " IQ Rating: ";

   

   if (aScore <= 100)

   {

       cout << "Below Average\n";

   }

   else if (aScore <= 119)

   {

       cout <<"Average\n";

   }

   else if (aScore <= 160)

   {

       cout << "Superior\n";

   }

   else if (aScore >= 160 )

   {

       cout << "Genius\n";

   }

}

4 0
3 years ago
Other questions:
  • Which ipv6 static route would serve as a backup route to a dynamic route learned through ospf?
    12·1 answer
  • To easily add an organizational chart to a document, users should select _____. SmartArt Text Boxes Shapes Clip Art
    8·2 answers
  • Which zone of the ocean is deepest ?
    7·2 answers
  • Does Windows 7 support secure boot in UEFI? Windows eight? Linux UBUNTU version 14?
    8·1 answer
  • True or false.the color attribute cannot recognized the hexadecimal code.
    7·2 answers
  • Joe always misspelled the word calendar what function corrects the word
    12·2 answers
  • The model for Diminishing Marginal Utility is ______ in nature.
    12·1 answer
  • Sometimes a database can contain "bad data," meaning incomplete, incorrect, inaccurate, or irrelevant records, which can be corr
    7·1 answer
  • Read the attached paper titled A Survey of Coarse-Grained Reconfigurable Architecture and comment on it. Make sure to specifical
    5·1 answer
  • What can handle work that is hard on a person and could cause repetitive injuries?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!