Issue with header file.

Having a problem setting my declarations for paper1. This class has been fairly easy to this point. I am not sure if I missed a chapter but I am at a loss. No matter what I try I get errors. Any help would be appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Pseudocode PLD Chapter 10 #3 pg. 445
// 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




#include <iostream>
#include <string>
#include <cstdlib>
#include "termpaper.h"

using namespace std;

int main()
{
     
      string firstName;
      string lastName;
      string subject;
      char grade;
      
      cout << "Please enter first name.   " << endl;
      cin >> firstName;
      
      cout << "Please enter last name.   " << endl;
      cin >> lastName;
      
      cout << "Please enter subject.   " << endl;
      cin >> subject;
      
      cout << "Please enter grade.   " << endl;
      cin >> grade;
      
//     Set the first name for paper1
//     Set the last name for paper1
//     Set the subject for paper1
//     Set the letter grade for paper1
            
      cout << "First Name: " << paper1.getFirstName();
      cout << "Last Name: " << paper1.getLastName();;
      cout << "Subject: " << paper1.getSubject();
      cout << "Grade: " << paper1.getGrade();
      
system("PAUSE");
return 0;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#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 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#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;
}


What do you have problems with?
You have not defined paper1 anywhere.
I am having the same problem but can not figure out how to define paper1. I know its prob something easy but just can't get it???
closed account (3qX21hU5)
If you have having a problem similar zigfl03 post a new topic with your code and your problem and we can help you out.
Topic archived. No new replies allowed.