Question

In: Computer Science

using c plus plus: THE PROGRAMS SHOULD 3 DIFFERENT PARTS AS MAIN, STUDENTTYPE.H AND STUDENTTYPELMP.CPP. I...

using c plus plus: THE PROGRAMS SHOULD 3 DIFFERENT PARTS AS MAIN, STUDENTTYPE.H AND STUDENTTYPELMP.CPP. I ALWAYS GRADE MY ANSWERS. THANKS.

Chapter 9 defined the struct studentType to implement the basic properties of a student. Define the class studentType with the same components as the struct studentType, and add member functions to manipulate the data members. (Note that the data members of the class studentType must be private.)

Write a program to illustrate how to use the class studentType.

Struct studentType:

struct studentType
{
 string firstName;
 string lastName;
 char courseGrade;
 int testScore;
 int programmingScore;
 double GPA;
};

An example of the program is shown below:

Name: Sara Spilner
Grade: A
Test score: 89
Programming score: 92
GPA: 3.57

Solutions

Expert Solution

Code

STUDENTTYPE.H

#ifndef _STUDENTTYPE_H
#define _STUDENTTYPE_H
#include<string>
#include<iostream>
using namespace std;
class studentType
{
public:
   studentType(string,string,char,int,int,double);
   void setFirstname(string);
   void setLastname(string);
   void setCourseGrade(char);
   void setTestScore(int);
   void setProgramingScore(int);
   void setGPA(double);
   string getFirstname();
   string getLastname();
   char getCourseGrade();
   int getTestScore();
   int getProgramingScore();
   double getGPA();
private:
   string firstName;
   string lastName;
   char courseGrade;
   int testScore;
   int programmingScore;
   double GPA;
};
#endif

STUDENTTYPELMP.CPP

#include"STUDENTTYPE.h"

studentType::studentType(string fn,string ln,char cg,int tScore,int pScore,double gpa)
{
   firstName=fn;
   lastName=ln;
   courseGrade=cg;
   testScore=tScore;
   programmingScore=pScore;
   GPA=gpa;
}
char studentType::getCourseGrade()
{
   return courseGrade;
}
string studentType::getFirstname()
{
   return firstName;
}
string studentType::getLastname()
{
   return lastName;
}
int studentType::getProgramingScore()
{
   return programmingScore;
}
int studentType::getTestScore()
{
   return testScore;
}
double studentType::getGPA()
{
   return GPA;
}
void studentType::setCourseGrade(char cg)
{
   courseGrade=cg;
}
void studentType::setFirstname(string fn)
{
   firstName=fn;
}
void studentType::setGPA(double gpa)
{
   GPA=gpa;
}
void studentType::setLastname(string ln)
{
   lastName=ln;
}
void studentType::setTestScore(int tScore)
{
   testScore=tScore;
}
void studentType::setProgramingScore(int pScore)
{
   programmingScore=pScore;
}

Main.cpp

#include"STUDENTTYPE.h"
int main()
{
   studentType st("Sara","Spilner",'A',89,92,3.57);

   cout<<"Name: "<<st.getFirstname()<<" "<<st.getLastname()<<endl;
   cout<<"Grade: "<<st.getCourseGrade()<<endl;
   cout<<"Test score: "<<st.getTestScore()<<endl;
   cout<<"Programming score: "<<st.getProgramingScore()<<endl;
   cout<<"GPA: "<<st.getGPA()<<endl;
   return 1;
}

output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.


Related Solutions

has anyone finished all the parts to the question Programs Plus is a retail firm that...
has anyone finished all the parts to the question Programs Plus is a retail firm that sells computer programs for home and business use. On December 31, 2019, its general ledger contained the accounts and balances shown below: Only finding bits and pieces on here. College accounting Programs Plus is a retail firm that sells computer programs for home and business use. On  December 31, 2019, its general ledger contained the accounts and balances shown below: ACCOUNTS BALANCES Cash $ 15,280...
Explain the different types of health insurance programs. What are the main differences among these programs?...
Explain the different types of health insurance programs. What are the main differences among these programs? How are they similar? Be sure to use terms that are unique to benefits, compensation, and human relations
Explain the different types of health insurance programs. What are the main differences among these programs?...
Explain the different types of health insurance programs. What are the main differences among these programs? How are they similar? Be sure to use terms that are unique to benefits, compensation, and human relations.
Using C++ 1. Create a main function in a main.cpp file. The main function should look...
Using C++ 1. Create a main function in a main.cpp file. The main function should look as follows int main() {return 0;} 2. Create an array. 3. Ask user to enter numbers in size of your array. 4. Take the numbers and store them in your array. 5. Go through your array and add all the numbers. 6. Calculate the average of the numbers. 7. Display the numbers, sum and average.
Using C language: (Note: If a family of 4, apply family of 3 cost plus the...
Using C language: (Note: If a family of 4, apply family of 3 cost plus the cost of 1 participant. K800 is the fixed cost for a family of 3.) A bus company organizes a tour. The tour is open for 4 days and participants can register for the number of days they would like to participate in the tour. Each participant would pay K 300 for the tour per day, a family of 3 would pay K 800 per...
Code programs using ReadlineSync for prompts. Note: For all programs, create and call a main function,...
Code programs using ReadlineSync for prompts. Note: For all programs, create and call a main function, and if required additional functions called by the main. Also please use the ES6 style of keywords => instead of the older function and for local scope variables use the keyword let, not var Name: coinflip.js For this program you will have two functions, one called main and the second called flip. This program is also required the use of a loop construct. Write...
Code programs using ReadlineSync for prompts. Note: For all programs, create and call a main function,...
Code programs using ReadlineSync for prompts. Note: For all programs, create and call a main function, and if required additional functions called by the main. Also please use the ES6 style of keywords => instead of the older function and for local scope variables use the keyword let, not var Name: cookout.js Assume that hot dogs come in packages of 10, and hot dog buns come in packages of 8. Write a program called cookout.js, that calculates the number of...
Code programs using ReadlineSync for prompts. Note: For all programs, create and call a main function,...
Code programs using ReadlineSync for prompts. Note: For all programs, create and call a main function, and if required additional functions called by the main. Also please use the ES6 style of keywords => instead of the older function and for local scope variables use the keyword let, not var triangle.js Write a program that is required to use nested loops to generate a triangle as shown in the sample run below. The program should begin by prompting the user...
compile and link two c programs from cmd prompt: using command gcc program1.c program2.h -o main...
compile and link two c programs from cmd prompt: using command gcc program1.c program2.h -o main but getting error undefined reference to scheduleFCFS not sure how to correct issue.
Describe two different advocacy programs and the program's main mission and the services provided
Describe two different advocacy programs and the program's main mission and the services provided
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT