Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

CPP File

#include "result.h"
#include "Date.h"


Result::Result()
{
m_name = "";
m_unitID = "";
m_credits = 0;
m_mark = 0.0;
m_day = 0;
m_month = "";
m_year = 0;
}

Result::Result( string name, string id,unsigned credits, double M , unsigned d, string m, unsigned y)
{
m_name = name;
m_unitID = id;
m_credits = credits;
m_mark = M;
m_day = d;
m_month = m;
m_year = y;
}

istream & operator >>( istream & input, Result & RE)
{
string strInput;

getline(input,strInput, ',');

RE.SetUnitID(strInput);
getline(input, strInput, ',');

RE.SetName(strInput);
getline(input, strInput, ',');

RE.SetCredits(stoi(strInput));
getline(input, strInput, ',');

RE.SetMark(stod(strInput));
getline(input,strInput, ',');

RE.SetDay(stoi(strInput));
getline(input, strInput, ',');

RE.SetMonth(strInput);
getline(input, strInput, ',');

RE.SetYear(stoi(strInput));
getline(input, strInput, ',');

return input;
}

ostream & operator <<( ostream & os,const Result & RE )
{
string unitID;
string name;
string month;
double mark;

RE.GetUnitID(unitID);
RE.GetName(name);
RE.GetMonth(month);
RE.GetMark(mark);

os << " Unit ID: " << unitID << '\n'
<< " Unit Name: " << name << '\n'
<< " Credits: " << RE.GetCredits() << '\n'
<< " Mark: " << mark << '\n'
<< " Date: " << RE.GetDay() << " " << month << " " << RE.GetYear() << '\n';

return os;
}

Header File

#ifndef RESULT_H
#define RESULT_H

#include <iostream>
#include <string>

using namespace std;

const unsigned UnitNameSize = 40;

class Result {
public:
Result();
Result( std::string (nam), string id, unsigned credits , double M, unsigned d, string m, unsigned y);
// Construct a course from a name, section letter,
// and number of credits.

void GetName (string &name) const;
void SetName(const string &name);

void GetUnitID(string &id) const;
void SetUnitID(const string &id);

unsigned GetCredits() const;
void SetCredits(unsigned credits);

double GetMark() const;
void SetMark(double M);

unsigned GetDay() const;
void SetDay(unsigned d);

void GetMonth(string &m) const;
void SetMonth(string &m);

unsigned GetYear() const;
void SetYear(unsigned y);


// These operators have been made friends. They have
// privileged access to class internals.
// Very useful for debugging the class, but not very good for class design.
// We will keep using it for now but you will have a chance in a later lab
// to redesign this class.
friend ostream & operator <<( ostream & os, const Result & RE );
friend istream & operator >>( istream & input, Result & RE );

private:
string m_name; // course name, C style string. not a C++ string object
string m_unitID; // section (letter) can be enrolment mode
int m_credits; // number of credits
double m_mark; // marks
int m_day; // day of the date
string m_month; //month of the date
int m_year; // year of the date
};


void Result::GetName (string &name) const
{
name = m_name;
}

void Result::SetName(const string &name)
{
m_name = name;
}

void Result::GetUnitID(string &id) const
{
id = m_unitID;
}

void Result::SetUnitID(const string &id)
{
m_unitID = id;
}

unsigned Result::GetCredits() const
{
return m_credits;
}

void Result::SetCredits(unsigned credits)
{
m_credits = credits;
}

double Result::GetMark() const
{
return m_mark;
}

void Result::SetMark(double M)
{
m_mark = M;
}

unsigned Result::GetDay() const
{
return m_day;
}

void Result::SetDay(unsigned d)
{
m_day = d;
}

void Result::GetMonth(string &m) const
{
m = m_month;
}

void Result::SetMonth(string &m)
{
m_month = m;
}

unsigned Result::GetYear() const
{
return m_year;
}

void Result::SetYear(unsigned y)
{
m_year = y;
}

after implementing this code in an attempt to let the program read an input file with the method getline, I came across an error that says "error: no matching function for call to 'Result: : GetMark(double&) const'"

I need the body of the methods to be in the CPP file and only the method and class declaration to be in the .H file only. i have multiple other files that I cant post here but it all works together.

Transcribed Image Text:File Edit Format View Help 102234 2 ICT281, Data Structures And Abstractions ,3, 90.1, 4, June, 1998 ICT167 ,Computer Graphics ,1, 67.2, 15, January, 1995 BSC231,Travel Guide ,4, 54.3, 23, December, 1990 BUS283 ,Sports And Wellbeing ,3, 87.7, 1, February, 1999
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education