Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,843 members, 7,820,934 topics. Date: Wednesday, 08 May 2024 at 04:02 AM

Labiran's Posts

Nairaland Forum / Labiran's Profile / Labiran's Posts

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 13 pages)

Music/Radio / Re: I Need Someone To Tell Me The Name Of This Song Pls: by labiran(m): 4:01am On Nov 02, 2007
can u put more of the lyrics, i think i might know that song
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 7:25pm On Nov 01, 2007
@tboy 1:

thank you so much for your help

@Kobojunkie,
thanks for your help too.
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 6:03pm On Nov 01, 2007
@ tboy1,
my email is :

labiran@hotmail.com

@Kobojunkie,
i'm surprised at your level of thoughtlessness.  use your two eyes to read the starter of this thread.  It was not me!  My own started just a few days ago, not all the way back in March.  Who said I was blaming others?  It's like you are reading imaginary lines.  yes, i'm a beginner and did find your websites very helpful (thank you very much!).  it is just I needed like a trial and error experience because programming is hard for me.  I have actually already completed the project bro! thanks
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 11:38pm On Oct 29, 2007
anyone think they can get me started? i learn by trial and error
Programming / Re: Vb 6.0 Newbie by labiran(m): 2:07am On Oct 29, 2007
I find your websites very helpful. thanks
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 9:01pm On Oct 28, 2007
@ Kobojunkie, thank u for the advice
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 8:12pm On Oct 27, 2007
is it possible for me to show you my code? maybe you can tell what is wrong with it.
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 7:54pm On Oct 27, 2007
@ Kobojunkie,

thanks for the reading material. i tried to complete the program with it but it still doesn't work. i must be one of the worst programmers ever.
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 4:00am On Oct 27, 2007
@Kobojunkie,

can u pls tell me how to do it becuz i do read the book and still dont understand it. thank
Programming / Re: Please Need Help With Writing These C++ Programmes Please This Is Really Urgent by labiran(m): 5:11pm On Oct 26, 2007
can somebody help me write this:



Overview
Using the previous labs on C++ classes as examples, you will now write a class from scratch. Your class will be a 'Person' object and, like other classes, will have data members and member functions. Your class will have at least two constructors. It will also have accessor functions for each of the required data members. Additionally, the class you create must have a validate() function.

After the class has been written, you will use the class and instantiate a 'Person' by reading from a database file. After reading in each person, you will validate the 'Person' instantiated by assuring the data members have 'reasonable' values. Some of the values in the database will be 'unreasonable' and it is your task to sort each 'Person' instantiated into a file called 'valid.txt' and 'invalid.txt'. You are not allowed to alter the values of the original data file.

To get started, create a new empty Win32 Console Application project. Call the project Person Project, and the solution Lab09. Then click on Add Class in the Project menu and select C++ (in the left panel) and C++ Class (in the right panel). Enter the name of your new class: Person. Be sure to deselect all other options in the dialog box.

Preprocessor directives
Be sure to include all the preprocessor directives that your Person class will use. Preprocessor directives could be libraries, namespaces, #defines, etc. For example, you probably want to include the string class: #include <string>

Constructors
You are required to write a default constructor and a constructor that takes two parameters: first name and last name. You may write more constructors, if desired.

Data Members
The required data members are listed below. When declaring your data members, consider the range of possible values (and reasonable values) each data member can have. Doing so will help you choose the correct data type for that data member. (Using appropriate data types is an important part of memory management.)
Your class is required to have the following data members (their required ranges are listed as well, all data ranges are inclusive):

first name: any length string of characters
last name: any length string of characters
age: 0 through 115 (years)
gpa: 0.0 through 4.0
gender: M or F
height: 30.0 through 230.5 (cm)
You may include other data members, but these are required. Be sure that any other data members, and their requisite accessor functions, do not interfere with the requirements of the assignment.
Accessor Functions
You are required to have accessor functions for each of the above data members. Accessor functions, also called 'setters' and 'getters', either gets (returns) or sets a value associated with an object of the class.

Member Functions
You are required to have a function named 'validate' that returns a boolean and takes no parameters. This function, and any other function that makes no changes to the class data members, should be declared as 'const'. This function determines whether a given instance of a 'Person' is valid or invalid. An instance of a 'Person' is considered valid if all of its data values are within the given ranges. Data Members for first name and last name do not need to be validated.

You are encouraged to write other member functions that demonstrate your knowledge; these functions must not break the rest of your code!



Test Program
When writing a class, it is important to verify that your code meets the provided requirements, as well as any pre-conditions and post-conditions. To do this, after your class is written, you must write a program that tests each of your constructors, the end-points of each of the data members, each of the accessor functions, and any other member functions that you have included.

A good way to test a class is to instantiate several objects of that type using each of the constructors, then use all the accessors to return and set the data members. After this, the member functions can be tested by calling them with a range of values from the instantiated objects, particularly any relevant end-points. If there is any unexpected behavior, your class might have an error.

You will now write such a test program. We have provided some code for you to make this task easier: PersonTestExample.cpp (place this file into your Person project folder, along side your class header and source file). Our example code declares and opens files for you. If you have forgotten how to read or write data from a file stream object, refer back to Lab 5.

Using the provided database file, PersonFile.txt, you will read-in each line of data and instantiate a 'Person' with that data. Save this file into your Lab09/PersonClass directory. Each 'Person' object should then be 'validated' using the member function 'validate()'. If a particular object is valid, you will output all of the data members for that 'Person' object into a file called 'valid.txt'. If a particular object is invalid, you will output all of the data members for that 'Person' object to a file named 'invalid.txt'. You must provide these files as part of your .zip file submission (e.g., check that they are in your Lab09/PersonClass directory).

The format of the database file is as follows:
Each line of the file contains information for one person. This information is always in the following order:
lastname firstname age gpa gender height
These items are separated by spaces, i.e., there is one space character between each of the values, nothing else.

Hint: The Time class had you answer four bold questions to help organize your design. We encourage you to write down the answers to each of these questions again, this time for the Person class.

Hint: Design your algorithm BEFORE you begin coding.


Hint: Practice proper data encapsulation by using the 'public' and 'private' keywords appropriately.
Programming / Re: I Need Help On C++ Any Guru Here by labiran(m): 5:34pm On Oct 24, 2007
wow, nairaland is absolutely useless, cannot believe nobody can help me.
Programming / Re: I Need Help On C++ Any Guru Here by labiran(m): 2:07am On Oct 23, 2007
i can send the problem once someone repsonds
Programming / Re: I Need Help On C++ Any Guru Here by labiran(m): 2:02am On Oct 23, 2007
any1 in the house? i too need help with c++
Forum Games / Re: Look At The Person's Profile Above Yours & Make A Comment by labiran(m): 3:39am On Aug 03, 2007
very nice smiley
Food / Re: White Girls And Fufu by labiran(m): 3:38am On Aug 03, 2007
american like fufu? wow! make i dey go and check dis one ooohhh, abeg.
Food / Re: The Worst Food You've Ever Eaten !! by labiran(m): 4:49pm On Jul 18, 2007
sloppy joe
Food / Re: What Do You Feel Like Eating Now? by labiran(m): 4:42pm On Jul 18, 2007
akara with bread
Forum Games / Re: Guess That Nl Members Age by labiran(m): 11:32pm On Jul 11, 2007
17
Forum Games / Re: Look At The Person's Profile Above Yours & Make A Comment by labiran(m): 11:22pm On Jul 11, 2007
huh?
Forum Games / Re: When Was The Last Time You: by labiran(m): 2:41pm On Jul 10, 2007
3 weeks ago,


when was the last time you sh*t so badly, you had to call a plumber?
Forum Games / Re: Be The Last Person To Post Here: by labiran(m): 5:37pm On Jul 09, 2007
hey smiley
Nairaland / General / Re: Chat Line by labiran(m): 7:24pm On Jun 17, 2007
hello
Music/Radio / Re: King Sunny Ade: Are You A Fan Like Me? by labiran(m): 12:19am On Jun 16, 2007
did anybody here what one musician said recently? I was utterly shocked. Uwaifo said KSA cannot play guitar! shocked
Forum Games / Re: Be The Last Person To Post Here: by labiran(m): 10:35pm On Jun 13, 2007
u got concert videos?
Forum Games / Re: Be The Last Person To Post Here: by labiran(m): 5:33pm On Jun 05, 2007
smiley
Forum Games / Re: tpbm (the person below me) by labiran(m): 5:01am On Jun 05, 2007
wtf nah!


tpbm has blue toenails
Nairaland / General / Re: Chat Line by labiran(m): 3:39am On Jun 04, 2007
good, u?
Nairaland / General / Re: Chat Line by labiran(m): 3:15am On Jun 04, 2007
hi acidrop smiley
Forum Games / Re: Be The Last Person To Post Here: by labiran(m): 5:39am On Jun 03, 2007
sorry for the random ? but u know where i can find KSA's latest concert video?
Forum Games / Re: Be The Last Person To Post Here: by labiran(m): 5:26am On Jun 03, 2007
how u doin? smiley
Forum Games / Re: Be The Last Person To Post Here: by labiran(m): 5:19am On Jun 03, 2007
hi dblock smiley
Forum Games / Re: tpbm (the person below me) by labiran(m): 9:15pm On Jun 01, 2007
nah, sorry,

tpbm is barefoot right now

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 13 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 29
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.