473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Completely Lost...

bd
I am completely lost on the first assignment in my data structures
class. Last semester, my first C++ class was a piece of cake;
however, this year I am going to learn all about OOP.

My dilemma... this is an on-line class (as all of my classes have
been) and I am unable to just raise my hand and ask questions. I am
hoping that I won't get flamed too bad and some people on here will be
nice enough to help...

I am supposed to be writing a driver file, "Employee.cpp", that
somehow displays information from another file, "Employee.h".
"Employee.h" refers back to two other files, "Name.h" and
"Address.h". I think these files are referred to as classes.

I sort of get the idea of what we are doing, but I get lost in the
vocabulary of what to call certain items and techniques.

Any brave souls willing to look at my code and help out?

Sep 11 '07 #1
6 1530
bd wrote:
I am supposed to be writing a driver file, "Employee.cpp", that
somehow displays information from another file, "Employee.h".
"Employee.h" refers back to two other files, "Name.h" and
"Address.h". Â*I think these files are referred to as classes.

I sort of get the idea of what we are doing, but I get lost in the
vocabulary of what to call certain items and techniques.

Any brave souls willing to look at my code and help out?
No.

Your teacher has assumed a prerequisite has covered the difference between a
class and the .h file that some classes store in.

You must get down with more books than this course's tutorial, and you must
download online projects.

This newsgroup can't spoon-feed you all that stuff. We are always here to
help, but set the threshold above what should be in the first few chapters
of any programming tutorial!

--
Phlip
http://www.oreilly.com/catalog/9780596510657/
^ assert_xpath
http://tinyurl.com/23tlu5 <-- assert_raise_message
Sep 11 '07 #2
On Sep 10, 5:17 pm, Phlip <phlip2...@gmail.comwrote:
No.

Your teacher has assumed a prerequisite has covered the difference between a
class and the .h file that some classes store in.

You must get down with more books than this course's tutorial, and you must
download online projects.

This newsgroup can't spoon-feed you all that stuff. We are always here to
help, but set the threshold above what should be in the first few chapters
of any programming tutorial!
You have a good point, but I am not looking to get spoon-fed. I
realize now that I may have sounded that way. I am going to post my
Employee.h file. If anyone has any suggestions as to what I'm doing
wrong in the file, then I am certainly open to them.

+----------------------------------------------------------------------
+
#include <iostream>
#include <iomanip>
#include <string>
#include "Name.h"
#include "Address.h"

using namespace std;

class EMPLOYEE
{
private:
NAME empName;
ADDRESS empAddress;
string empSSN;

public:
//default constructor
EMPLOYEE()
{
empName("John","H.","Doe");
empAddress("99999 Sunset Boulevard" , "Beverly Hills", "CA",
"99999");
empSSN = "999-99-9999";
}

//non-default constructor
EMLOYEE(NAME nameDefault, ADDRESS addressDefault, string ssn)
{
empName = nameDefault.prtFullName();
empAddress = addressDefault.prtAddress();
empSSN = ssn;
}

~EMPLOYEE(){;}//destructor
NAME getName(){return empName;}
ADDRESS getAddress(){return empAddress;}
string getSSN(){return empSSN;}
void prtAll()
{
cout << empName.prtFullName() << ' ' << empAddress.prtAddress() << '
' << empSSN << endl;
}
}

+----------------------------------------------------------------------
+

Sep 11 '07 #3
bd wrote:
....
Any brave souls willing to look at my code and help out?
Not really.

Your questions needs to be more specific.

BTW, there are plenty of open source projects that show how you can
split functionality across multiple header files (virtually every open
source C++ program will do it).

I refer to ".h" files as "header" files because they usually get
referred to by "#include" pre-processor directives at the head. .h
files define the "INTERFACE". Think of the interface as that which you
need to publish for other code to use elements implementing the
interface. You can put anything in a header file as long as it is not a
definition of something that will become defined multiple times so that
you will not be able to link your code.

One way to approach this is to write your code all in one file and then
re-arrange the interface components and split the file after you have
something working.
Sep 11 '07 #4
Good idea.

Thanks...

Sep 11 '07 #5
Good idea.

Thanks...

Sep 11 '07 #6
"Dale" writes:
On Sep 10, 5:17 pm, Phlip <phlip2...@gmail.comwrote:
>No.

Your teacher has assumed a prerequisite has covered the difference
between a
class and the .h file that some classes store in.

You must get down with more books than this course's tutorial, and you
must
download online projects.

This newsgroup can't spoon-feed you all that stuff. We are always here to
help, but set the threshold above what should be in the first few
chapters
of any programming tutorial!

You have a good point, but I am not looking to get spoon-fed. I
realize now that I may have sounded that way. I am going to post my
Employee.h file. If anyone has any suggestions as to what I'm doing
wrong in the file, then I am certainly open to them.

+----------------------------------------------------------------------
+
#include <iostream>
#include <iomanip>
#include <string>
#include "Name.h"
#include "Address.h"

using namespace std;

class EMPLOYEE
{
private:
NAME empName;
ADDRESS empAddress;
string empSSN;

public:
//default constructor
EMPLOYEE()
{
empName("John","H.","Doe");
empAddress("99999 Sunset Boulevard" , "Beverly Hills", "CA",
"99999");
empSSN = "999-99-9999";
}

//non-default constructor
EMLOYEE(NAME nameDefault, ADDRESS addressDefault, string ssn)
{
empName = nameDefault.prtFullName();
empAddress = addressDefault.prtAddress();
empSSN = ssn;
}

~EMPLOYEE(){;}//destructor
NAME getName(){return empName;}
ADDRESS getAddress(){return empAddress;}
string getSSN(){return empSSN;}
void prtAll()
{
cout << empName.prtFullName() << ' ' << empAddress.prtAddress() << '
' << empSSN << endl;
}
}
Missing semi-colon. That's a killer mistake a lot of people make from time
to time. If you still have problems, repost the new code. It's not obvious
to me that that is your real unerlying problem.
+----------------------------------------------------------------------
+

Sep 11 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris P. | last post by:
I have a C# application that connects to Perl application on a UNIX server. I am able to connect and communicate both directions with the server, but there are several occasions when it appears...
6
by: Tony G. | last post by:
Hi there, I have an APS 3 application, running on a Windows 2003 Web edition server - it is a very busy website, and when users are click on certain links (membership info), a new window i...
2
by: garyusenet | last post by:
I am working with an application which is based on .net framework, and comes with an SDK. I've installed MS VB 2005 express edition. it seems to open most of the files in the sdk, but it gives...
3
by: William | last post by:
Hi I have an ASP.NET application that connects to an Access database. Everything works fine except for the Session object. Data in the session object is lost after I've made a call to the...
3
by: Tom | last post by:
I have a VB .NET application that has a text box with the following code to handle the leave event. Private Sub txtIDiscountRate_TextChanged(ByVal sender As System.Object, ByVal e As...
0
by: Nick | last post by:
I have a situation wherein i have a text box, that has abc() being executed whenever the lost focus event is triggered. However, there is an exceptional case where, if a button click causes the...
0
by: BerkshireGuy | last post by:
Has anyone come across a Lost and Found database to track a hotel's lost and found items? I would be curious to review a system of such. I've created one myself and have a question regarding...
7
by: Erik | last post by:
I have an application that uses sessions variables a lot but one I publish the application on the prod server these variables are lost. The application is written i c# 2.0 and I've set the...
2
by: maxkumar | last post by:
Hi, I am running a ASP.NET 1.1 site on Win Server 2003 with IIS 6.0. The website has been running for about 1.5 years now. In the past, we used to have random cases of session variables getting...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.