I need to design a class named TermPaper that holds an author's name, the subject of the paper, and an assigned letter grade. I am stuck on how to define and set paper1??
// 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
Before going about setting paper1 you need to define your TermPaper class.
1 2 3 4
class TermPaper
{
// Your stuff here
}
I would suggest you start by defining that class then come back here and post what you have done. So far it looks like you haven't done anything. If you don't know how classes work I would highly suggest you look at our tutorial here on them or any resource you have about classes.
EDIT: Missed the TermPaper.h header so you can disregard everything I said. I figured you had to create the class by yourself.
// 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
I don't know why I am struggling with this so much I can not figure out how to set the first name, last name, subject, and grade for paper1?? Im sorry I just missed // TermPaper paper1 in the example
Again I would highly highly suggest you go back and start over from the beginning with any resource you have that teaches you about classes. These are some of the most basic parts of classes and you need to know them to continue.
COPY AND PASTING CODE WILL DO NOTHING FOR YOU AND WILL JUST HURT YOU IN THE END. I say this because all you have done is copied and pasted this code from another topic on this forum. You haven't changed it one bit http://www.cplusplus.com/forum/beginner/101137/
I would suggest you start over from scratch and work through the parts you know step by step. Once you have done that come back and we can help.
But for now I for one will not help you because you have put no effort into your assignment. Hell you didn't even put a effort into understanding the code you copied and pasted...
Sorry but I did not copy and paste. I think we are in the same class because the assignment is due today and the other person asked for help this weekend also. I am in the process of looking for tutorials and other options. I am just having a hard time grasping all of this. Thank you for the help I will try to figure it out.