Write a C++ Program Design a class named TermPaper that holds an author’s name, the subject of the paper, and an assigned letter grade. Include methods to set the values for each data field and display the values for each data field. Create the class diagram and write the pseudocode that defines the class. Pseudocode PLD Chapter 10 #3 pg. 468 // Start // Declarations // TermPaper paper1 // string firstName // string lastName // string subject // character grade
Write a C++ Program
Design a class named TermPaper that holds an author’s name, the subject of the paper, and an assigned letter grade. Include methods to set the values for each data field and display the values for each data field. Create the class diagram and write the pseudocode that defines the class.
Pseudocode PLD Chapter 10 #3 pg. 468
// Start
// Declarations
// TermPaper paper1
// string firstName
// string lastName
// string subject
// character grade
// output "Please enter first name. "
// input firstName
// output "Please enter last name. "
// input lastName
// output "Please enter subject. "
// input subject
// output "Please enter letter grade. "
// input grade
// Set the first name for paper1
// Set the last name for paper1
// Set the subject for paper1
// Set the letter grade for paper1
// output "First Name: ", paper1.getFirstName()
// output "Last Name: ", paper1.getLastName()
// output "Subject: ", paper1.getSubject()
// output "Grade: ", paper1.getGrade()
// Stop
header file
#include <string>
using namespace std;
#ifndef _TermPaper
#define _TermPaper
class TermPaper
{
private:
string fName; // first name
string lName; // last name
string subject; // subject of the paper
char letterGrade; // assigned letter grade
public:
TermPaper( );
void setFName(string fN);
void setLName(string lN);
void setSubject(string sub);
void setLetterGrade(char grade);
string getFName( );
string getLName( );
string getSubject( );
char getLetterGrade( );
};
#endif
Term Paper.cpp
#include <cstdlib>
#include <iostream>
#include "Termpaper.h"
using namespace std;
TermPaper::TermPaper( )
{
fName = "";
lName = "";
subject = "";
letterGrade = 'F';
}
void TermPaper::setFName(string fN)
{
fName = fN;
}
void TermPaper::setLName(string lN)
{
lName = lN;
}
void TermPaper::setSubject(string sub)
{
subject = sub;
}
void TermPaper::setLetterGrade(char grade)
{
letterGrade = grade;
}
string TermPaper::getFName( )
{
return fName;
}
string TermPaper::getLName( )
{
return lName;
}
string TermPaper::getSubject( )
{
return subject;
}
char TermPaper::getLetterGrade( )
{
return letterGrade;
}
An example of what I need help written:
// This program uses the programmer-defined Vehicle class.
#include <iostream>
#include "Vehicle.h"
using namespace std;
int main()
{
Vehicle vehicleOne;
vehicleOne.setMaxSpeed(100.0);
vehicleOne.setSpeed(35.0);
vehicleOne.accelerate(10.0);
cout << "The current speed is " << vehicleOne.getSpeed() << endl;
vehicleOne.accelerate(60.0);
cout << "The current speed is " << vehicleOne.getSpeed() << endl;
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps