SlideShare a Scribd company logo
1 of 9
#include <iostream>
#include <vector>
#include "Date.h"
#include "Person.h"
#include "DateException.h"
#include "PersonExceptions.h"
int main() {
std::string firstName;
std::string lastName;
int birthMonth;
int birthDay;
int birthYear;
float height;
float weight;
char answer = 'y';
std::vector<CIST2362::Person> personDatabase; // vector of Person Objects
// input person objects
// You must catch exceptions properly
while (toupper(answer) == 'Y') {
std::cin >> firstName;
std::cin >> lastName;
std::cin >> birthMonth;
std::cin >> birthDay;
std::cin >> birthYear;
std::cin >> weight;
std::cin >> height;
// place person objects into vector
// ENTER CODE HERE
std::cin >> answer;
}
// output the person objects
// ENTER CODE HERE
return 0;
}
(Date.cpp)
#include "Date.h"
#include "DateException.h"
#include <sstream>
namespace CIST2362 {
Date::Date() {
// ENTER CODE HERE
}
Date::Date(int m, int d, int y) {
// ENTER CODE HERE
}
void Date::setNames() {
names[0] = "January";
names[1] = "Febraury";
names[2] = "March";
names[3] = "April";
names[4] = "May";
names[5] = "June";
names[6] = "July";
names[7] = "August";
names[8] = "September";
names[9] = "October";
names[10] = "November";
names[11] = "December";
}
void Date::setMonth(int m) {
// ENTER CODE HERE
}
void Date::setDay(int d) {
// ENTER CODE HERE
}
void Date::setYear(int y) {
// ENTER CODE HERE
}
std::string Date::getDateShort() {
// ENTER CODE HERE
return "M/D/Y";
}
std::string Date::getDateLong() {
// ENTER CODE HERE
return "Month Day, Year";
}
} // CIST2362
(Date.h)
#ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_DATE_H
#define LESSON_5_PROGRAMMING_ASSIGNMENT_DATE_H
#include <iostream>
#include <string>
namespace CIST2362 {
// Constants
const int NUM_MONTHS = 12;
class Date {
private:
int month;
int day;
int year;
// An array of strings to hold
// the names of the months
std::string names[NUM_MONTHS];
// Private member function to assign
// the month names to the names array
void setNames();
public:
// Constructors
Date();
Date(int, int, int);
// Mutators
void setMonth(int m);
void setDay(int d);
void setYear(int y);
// Functions to print the date
std::string getDateShort();
std::string getDateLong();
};
} // CIST2362
#endif //LESSON_5_PROGRAMMING_ASSIGNMENT_DATE_H
(DateException.cpp)
#include "DateException.h"
namespace CIST2362 {
// ENTER CODE HERE
} // CIST2362
(DateException.h)
#ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_DATEEXCEPTION_H
#define LESSON_5_PROGRAMMING_ASSIGNMENT_DATEEXCEPTION_H
#include <exception>
namespace CIST2362 {
// Exception classes
class InvalidDay: public std::exception {
public:
// ENTER CODE HERE
};
class InvalidMonth: public std::exception {
public:
// ENTER CODE HERE
};
class InvalidYear: public std::exception {
public:
// ENTER CODE HERE
};
} // CIST2362
#endif //LESSON_5_PROGRAMMING_ASSIGNMENT_DATEEXCEPTION_H
(Person.cpp)
#include <sstream>
#include <iomanip>
#include "Person.h"
#include "PersonExceptions.h"
namespace CIST2362 {
const std::string &Person::getFirstName() const {
// ENTER CODE HERE
}
void Person::setFirstName(const std::string &firstName) {
// ENTER CODE HERE
}
const std::string &Person::getLastName() const {
// ENTER CODE HERE
}
void Person::setLastName(const std::string &lastName) {
// ENTER CODE HERE
}
const Date &Person::getBirthdate() const {
// ENTER CODE HERE
}
void Person::setBirthdate(const Date &birthdate) {
// ENTER CODE HERE
}
float Person::getHeight() const {
// ENTER CODE HERE
}
void Person::setHeight(float height) {
// ENTER CODE HERE
}
float Person::getWeight() const {
// ENTER CODE HERE
}
void Person::setWeight(float weight) {
// ENTER CODE HERE
}
Person::Person(const std::string &firstName, const std::string &lastName, int birthday,
int birthmonth, int birthyear, float height, float weight) : firstName(firstName),
lastName(lastName), birthdate(birthday, birthmonth, birthyear) {
// ENTER CODE HERE
}
std::string Person::toString() {
// ENTER CODE HERE
return "string of Person Data";
}
} // CIST2362
(Person.h)
#ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_PERSON_H
#define LESSON_5_PROGRAMMING_ASSIGNMENT_PERSON_H
#include <string>
#include "Date.h"
namespace CIST2362 {
class Person {
private:
std::string firstName;
std::string lastName;
Date birthdate;
float height;
float weight;
public:
Person(const std::string &firstName, const std::string &lastName, int birthday, int birthmonth,
int birthyear, float height, float weight);
const std::string &getFirstName() const;
void setFirstName(const std::string &firstName);
const std::string &getLastName() const;
void setLastName(const std::string &lastName);
const Date &getBirthdate() const;
void setBirthdate(const Date &birthdate);
float getHeight() const;
void setHeight(float height);
float getWeight() const;
void setWeight(float weight);
std::string toString();
};
} // CIST2362
#endif //LESSON_5_PROGRAMMING_ASSIGNMENT_PERSON_H
(PersonExceptions.cpp)
#include "PersonExceptions.h"
namespace CIST2362 {
// ENTER CODE HERE
} // CIST2362
(PersonExceptions.h)
#ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_PERSONEXCEPTIONS_H
#define LESSON_5_PROGRAMMING_ASSIGNMENT_PERSONEXCEPTIONS_H
#include <exception>
namespace CIST2362 {
class badHeight: public std::exception {
public:
// ENTER CODE HERE
};
class badWeight: public std::exception {
public:
// ENTER CODE HERE
};
} // CIST2362
#endif //LESSON_5_PROGRAMMING_ASSIGNMENT_PERSONEXCEPTIONS_H
14.16 CIST2362 Programming Project: Processing a Vector of People This program allows users
to input person data, storing that data in a vector. Then after the last person the program outputs
the person data. The data collected for each person is first and last name, date of birth as month,
day, and year, and the weight and height. Ex: if input is: the output is: |Anne|Niebuhr|Febraury
15, 1996 5.7 feet|104.9 lbs| |Jesse|Choi|December 4, 1962| 5.1 feet|161.9 lbs| This is what will
happen if all the data is entered correctly. However, your program should use exceptions to
potential input errors: - if the month is out of range 1 to 12 , your exception should produce the
message: Invalid Month assigned - must be 1 to 12 - if the day is out of range of 1 to 31, your
exception should produce the message: Invalid Day assigned - must be 1 to 31 - if the year is a
negative value, your exception should produce the message: Invalid Year assigned - must be a
positive number - if the height is negative, your exception should produce the message: Invalid
Height assigned - must be a positive number - if the weight is negative, your exception should
produce the message: Invalid Weight assigned - must be a positive number In order to get this
program working properly, you will need to insert missing code in all of the files. There are quite
a few files, but take it one at a time. Remember, there are quite a few unit tests to test your
classes before you need to get the main working. Take advantage of this to incrementally build
and test your classes. Also, remember that you can build stubs that will allow you to compile the
program until you are able to completely fill in the code. Note that this program makes use of
Namespaces. You are expected to explicitly use the namespaces versus employing the "using"
statement. This means you will have code like std: : cin that says you are referencing cin from
the standard namespace. The other namespace you will have in this program is the CIST2362
namespace. All of the classes in your program belong to this namespace, and so you will see
CIST2362: : Person referring to the Person class in the CIST2362 namespace. Namespaces are
covered in Chapter 9 if you need to refer back.
#include -iostream- #include -vector- #include -Date-h- #include -Pers.docx

More Related Content

Similar to #include -iostream- #include -vector- #include -Date-h- #include -Pers.docx

C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFAbcdR5
 
Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016PVS-Studio
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project AnalyzedPVS-Studio
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...bhargavi804095
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js ModuleFred Chien
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfjanakim15
 
Test flawfinder. This program wont compile or run; thats not
 Test flawfinder.  This program wont compile or run; thats not Test flawfinder.  This program wont compile or run; thats not
Test flawfinder. This program wont compile or run; thats notMoseStaton39
 
Checking 7-Zip with PVS-Studio analyzer
Checking 7-Zip with PVS-Studio analyzerChecking 7-Zip with PVS-Studio analyzer
Checking 7-Zip with PVS-Studio analyzerPVS-Studio
 
Critical errors in CryEngine V code
Critical errors in CryEngine V codeCritical errors in CryEngine V code
Critical errors in CryEngine V codePVS-Studio
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003R696
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 

Similar to #include -iostream- #include -vector- #include -Date-h- #include -Pers.docx (20)

C++ How to program
C++ How to programC++ How to program
C++ How to program
 
Book
BookBook
Book
 
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
 
Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
 
OOPS 22-23 (1).pptx
OOPS 22-23 (1).pptxOOPS 22-23 (1).pptx
OOPS 22-23 (1).pptx
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js Module
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdf
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Test flawfinder. This program wont compile or run; thats not
 Test flawfinder.  This program wont compile or run; thats not Test flawfinder.  This program wont compile or run; thats not
Test flawfinder. This program wont compile or run; thats not
 
Checking 7-Zip with PVS-Studio analyzer
Checking 7-Zip with PVS-Studio analyzerChecking 7-Zip with PVS-Studio analyzer
Checking 7-Zip with PVS-Studio analyzer
 
Critical errors in CryEngine V code
Critical errors in CryEngine V codeCritical errors in CryEngine V code
Critical errors in CryEngine V code
 
Clean code
Clean codeClean code
Clean code
 
C Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.comC Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.com
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
LEARN C#
LEARN C#LEARN C#
LEARN C#
 
Day 1
Day 1Day 1
Day 1
 
C Programming
C ProgrammingC Programming
C Programming
 

More from hoggardbennie

( 1 point) Generate two random numbers between 0 and 1 and take X to b.docx
( 1 point) Generate two random numbers between 0 and 1 and take X to b.docx( 1 point) Generate two random numbers between 0 and 1 and take X to b.docx
( 1 point) Generate two random numbers between 0 and 1 and take X to b.docxhoggardbennie
 
(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docx
(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docx(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docx
(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docxhoggardbennie
 
1 52 - 14 () - 11 If the interest rate is 10- per year compounde.docx
1  52 - 14  () -    11  If the interest rate is 10- per year compounde.docx1  52 - 14  () -    11  If the interest rate is 10- per year compounde.docx
1 52 - 14 () - 11 If the interest rate is 10- per year compounde.docxhoggardbennie
 
-Mosquitoes appear to use odors to help them distinguish what is nearb.docx
-Mosquitoes appear to use odors to help them distinguish what is nearb.docx-Mosquitoes appear to use odors to help them distinguish what is nearb.docx
-Mosquitoes appear to use odors to help them distinguish what is nearb.docxhoggardbennie
 
-template- (I assume that all of the text below goes in the body of th.docx
-template- (I assume that all of the text below goes in the body of th.docx-template- (I assume that all of the text below goes in the body of th.docx
-template- (I assume that all of the text below goes in the body of th.docxhoggardbennie
 
--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docx
--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docx--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docx
--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docxhoggardbennie
 
-f- Derive- A(BC).docx
-f- Derive- A(BC).docx-f- Derive- A(BC).docx
-f- Derive- A(BC).docxhoggardbennie
 
-Emotions are now often seen as central to certain organisational role.docx
-Emotions are now often seen as central to certain organisational role.docx-Emotions are now often seen as central to certain organisational role.docx
-Emotions are now often seen as central to certain organisational role.docxhoggardbennie
 
-- C Program How might I modify this code to handle any number of comm.docx
-- C Program How might I modify this code to handle any number of comm.docx-- C Program How might I modify this code to handle any number of comm.docx
-- C Program How might I modify this code to handle any number of comm.docxhoggardbennie
 
- What is osmosis and the three types of osmosis- Explain- - Which typ.docx
- What is osmosis and the three types of osmosis- Explain- - Which typ.docx- What is osmosis and the three types of osmosis- Explain- - Which typ.docx
- What is osmosis and the three types of osmosis- Explain- - Which typ.docxhoggardbennie
 
- Toss a coin three times- Let X- Heads - Tails- Find the distributio.docx
- Toss a coin three times- Let X- Heads -  Tails- Find the distributio.docx- Toss a coin three times- Let X- Heads -  Tails- Find the distributio.docx
- Toss a coin three times- Let X- Heads - Tails- Find the distributio.docxhoggardbennie
 
(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docx
(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docx(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docx
(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docxhoggardbennie
 
- Let X be a random variable has a normal distribution with -30 and -1.docx
- Let X be a random variable has a normal distribution with -30 and -1.docx- Let X be a random variable has a normal distribution with -30 and -1.docx
- Let X be a random variable has a normal distribution with -30 and -1.docxhoggardbennie
 
- A patient with emphysema is admitted to your unit- The patient is s.docx
-  A patient with emphysema is admitted to your unit- The patient is s.docx-  A patient with emphysema is admitted to your unit- The patient is s.docx
- A patient with emphysema is admitted to your unit- The patient is s.docxhoggardbennie
 
(X-Y)-(1-1)limxyxy.docx
(X-Y)-(1-1)limxyxy.docx(X-Y)-(1-1)limxyxy.docx
(X-Y)-(1-1)limxyxy.docxhoggardbennie
 
(shady) conditions will most likely have a-fewer chloroplasts than sun.docx
(shady) conditions will most likely have a-fewer chloroplasts than sun.docx(shady) conditions will most likely have a-fewer chloroplasts than sun.docx
(shady) conditions will most likely have a-fewer chloroplasts than sun.docxhoggardbennie
 
(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docx
(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docx(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docx
(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docxhoggardbennie
 
(a) Are these data categorical or quantitative- categorical quantitati.docx
(a) Are these data categorical or quantitative- categorical quantitati.docx(a) Are these data categorical or quantitative- categorical quantitati.docx
(a) Are these data categorical or quantitative- categorical quantitati.docxhoggardbennie
 
(a) The vector xRN has L different entries- For example- L-4 for x--3-.docx
(a) The vector xRN has L different entries- For example- L-4 for x--3-.docx(a) The vector xRN has L different entries- For example- L-4 for x--3-.docx
(a) The vector xRN has L different entries- For example- L-4 for x--3-.docxhoggardbennie
 

More from hoggardbennie (20)

( 1 point) Generate two random numbers between 0 and 1 and take X to b.docx
( 1 point) Generate two random numbers between 0 and 1 and take X to b.docx( 1 point) Generate two random numbers between 0 and 1 and take X to b.docx
( 1 point) Generate two random numbers between 0 and 1 and take X to b.docx
 
(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docx
(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docx(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docx
(4) Ni is and D indebendent everts- Yes- bocine T(p)-F(0M) No- beause.docx
 
1 52 - 14 () - 11 If the interest rate is 10- per year compounde.docx
1  52 - 14  () -    11  If the interest rate is 10- per year compounde.docx1  52 - 14  () -    11  If the interest rate is 10- per year compounde.docx
1 52 - 14 () - 11 If the interest rate is 10- per year compounde.docx
 
-Mosquitoes appear to use odors to help them distinguish what is nearb.docx
-Mosquitoes appear to use odors to help them distinguish what is nearb.docx-Mosquitoes appear to use odors to help them distinguish what is nearb.docx
-Mosquitoes appear to use odors to help them distinguish what is nearb.docx
 
-template- (I assume that all of the text below goes in the body of th.docx
-template- (I assume that all of the text below goes in the body of th.docx-template- (I assume that all of the text below goes in the body of th.docx
-template- (I assume that all of the text below goes in the body of th.docx
 
--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docx
--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docx--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docx
--- - Class to demonstrate Generic Pair class -author john1819 - -- pu.docx
 
-f- Derive- A(BC).docx
-f- Derive- A(BC).docx-f- Derive- A(BC).docx
-f- Derive- A(BC).docx
 
-Emotions are now often seen as central to certain organisational role.docx
-Emotions are now often seen as central to certain organisational role.docx-Emotions are now often seen as central to certain organisational role.docx
-Emotions are now often seen as central to certain organisational role.docx
 
-- C Program How might I modify this code to handle any number of comm.docx
-- C Program How might I modify this code to handle any number of comm.docx-- C Program How might I modify this code to handle any number of comm.docx
-- C Program How might I modify this code to handle any number of comm.docx
 
- What is osmosis and the three types of osmosis- Explain- - Which typ.docx
- What is osmosis and the three types of osmosis- Explain- - Which typ.docx- What is osmosis and the three types of osmosis- Explain- - Which typ.docx
- What is osmosis and the three types of osmosis- Explain- - Which typ.docx
 
- Toss a coin three times- Let X- Heads - Tails- Find the distributio.docx
- Toss a coin three times- Let X- Heads -  Tails- Find the distributio.docx- Toss a coin three times- Let X- Heads -  Tails- Find the distributio.docx
- Toss a coin three times- Let X- Heads - Tails- Find the distributio.docx
 
(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docx
(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docx(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docx
(1) In the tubular flowers of foxgloves- wild-type coloration is red-.docx
 
- Let X be a random variable has a normal distribution with -30 and -1.docx
- Let X be a random variable has a normal distribution with -30 and -1.docx- Let X be a random variable has a normal distribution with -30 and -1.docx
- Let X be a random variable has a normal distribution with -30 and -1.docx
 
- A patient with emphysema is admitted to your unit- The patient is s.docx
-  A patient with emphysema is admitted to your unit- The patient is s.docx-  A patient with emphysema is admitted to your unit- The patient is s.docx
- A patient with emphysema is admitted to your unit- The patient is s.docx
 
(X-Y)-(1-1)limxyxy.docx
(X-Y)-(1-1)limxyxy.docx(X-Y)-(1-1)limxyxy.docx
(X-Y)-(1-1)limxyxy.docx
 
(shady) conditions will most likely have a-fewer chloroplasts than sun.docx
(shady) conditions will most likely have a-fewer chloroplasts than sun.docx(shady) conditions will most likely have a-fewer chloroplasts than sun.docx
(shady) conditions will most likely have a-fewer chloroplasts than sun.docx
 
(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docx
(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docx(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docx
(i) Werck the icon to vere the trpssictons) More info Requirements 1-.docx
 
(ABC)B.docx
(ABC)B.docx(ABC)B.docx
(ABC)B.docx
 
(a) Are these data categorical or quantitative- categorical quantitati.docx
(a) Are these data categorical or quantitative- categorical quantitati.docx(a) Are these data categorical or quantitative- categorical quantitati.docx
(a) Are these data categorical or quantitative- categorical quantitati.docx
 
(a) The vector xRN has L different entries- For example- L-4 for x--3-.docx
(a) The vector xRN has L different entries- For example- L-4 for x--3-.docx(a) The vector xRN has L different entries- For example- L-4 for x--3-.docx
(a) The vector xRN has L different entries- For example- L-4 for x--3-.docx
 

Recently uploaded

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 

#include -iostream- #include -vector- #include -Date-h- #include -Pers.docx

  • 1. #include <iostream> #include <vector> #include "Date.h" #include "Person.h" #include "DateException.h" #include "PersonExceptions.h" int main() { std::string firstName; std::string lastName; int birthMonth; int birthDay; int birthYear; float height; float weight; char answer = 'y'; std::vector<CIST2362::Person> personDatabase; // vector of Person Objects // input person objects // You must catch exceptions properly while (toupper(answer) == 'Y') { std::cin >> firstName; std::cin >> lastName; std::cin >> birthMonth; std::cin >> birthDay; std::cin >> birthYear; std::cin >> weight; std::cin >> height; // place person objects into vector // ENTER CODE HERE std::cin >> answer; } // output the person objects // ENTER CODE HERE return 0; } (Date.cpp)
  • 2. #include "Date.h" #include "DateException.h" #include <sstream> namespace CIST2362 { Date::Date() { // ENTER CODE HERE } Date::Date(int m, int d, int y) { // ENTER CODE HERE } void Date::setNames() { names[0] = "January"; names[1] = "Febraury"; names[2] = "March"; names[3] = "April"; names[4] = "May"; names[5] = "June"; names[6] = "July"; names[7] = "August"; names[8] = "September"; names[9] = "October"; names[10] = "November"; names[11] = "December"; } void Date::setMonth(int m) { // ENTER CODE HERE } void Date::setDay(int d) { // ENTER CODE HERE } void Date::setYear(int y) { // ENTER CODE HERE } std::string Date::getDateShort() {
  • 3. // ENTER CODE HERE return "M/D/Y"; } std::string Date::getDateLong() { // ENTER CODE HERE return "Month Day, Year"; } } // CIST2362 (Date.h) #ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_DATE_H #define LESSON_5_PROGRAMMING_ASSIGNMENT_DATE_H #include <iostream> #include <string> namespace CIST2362 { // Constants const int NUM_MONTHS = 12; class Date { private: int month; int day; int year; // An array of strings to hold // the names of the months std::string names[NUM_MONTHS]; // Private member function to assign // the month names to the names array void setNames(); public: // Constructors Date(); Date(int, int, int); // Mutators void setMonth(int m);
  • 4. void setDay(int d); void setYear(int y); // Functions to print the date std::string getDateShort(); std::string getDateLong(); }; } // CIST2362 #endif //LESSON_5_PROGRAMMING_ASSIGNMENT_DATE_H (DateException.cpp) #include "DateException.h" namespace CIST2362 { // ENTER CODE HERE } // CIST2362 (DateException.h) #ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_DATEEXCEPTION_H #define LESSON_5_PROGRAMMING_ASSIGNMENT_DATEEXCEPTION_H #include <exception> namespace CIST2362 { // Exception classes class InvalidDay: public std::exception { public: // ENTER CODE HERE }; class InvalidMonth: public std::exception { public: // ENTER CODE HERE }; class InvalidYear: public std::exception { public: // ENTER CODE HERE };
  • 5. } // CIST2362 #endif //LESSON_5_PROGRAMMING_ASSIGNMENT_DATEEXCEPTION_H (Person.cpp) #include <sstream> #include <iomanip> #include "Person.h" #include "PersonExceptions.h" namespace CIST2362 { const std::string &Person::getFirstName() const { // ENTER CODE HERE } void Person::setFirstName(const std::string &firstName) { // ENTER CODE HERE } const std::string &Person::getLastName() const { // ENTER CODE HERE } void Person::setLastName(const std::string &lastName) { // ENTER CODE HERE } const Date &Person::getBirthdate() const { // ENTER CODE HERE } void Person::setBirthdate(const Date &birthdate) { // ENTER CODE HERE } float Person::getHeight() const { // ENTER CODE HERE } void Person::setHeight(float height) { // ENTER CODE HERE }
  • 6. float Person::getWeight() const { // ENTER CODE HERE } void Person::setWeight(float weight) { // ENTER CODE HERE } Person::Person(const std::string &firstName, const std::string &lastName, int birthday, int birthmonth, int birthyear, float height, float weight) : firstName(firstName), lastName(lastName), birthdate(birthday, birthmonth, birthyear) { // ENTER CODE HERE } std::string Person::toString() { // ENTER CODE HERE return "string of Person Data"; } } // CIST2362 (Person.h) #ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_PERSON_H #define LESSON_5_PROGRAMMING_ASSIGNMENT_PERSON_H #include <string> #include "Date.h" namespace CIST2362 { class Person { private: std::string firstName; std::string lastName; Date birthdate; float height; float weight; public: Person(const std::string &firstName, const std::string &lastName, int birthday, int birthmonth, int birthyear, float height, float weight); const std::string &getFirstName() const;
  • 7. void setFirstName(const std::string &firstName); const std::string &getLastName() const; void setLastName(const std::string &lastName); const Date &getBirthdate() const; void setBirthdate(const Date &birthdate); float getHeight() const; void setHeight(float height); float getWeight() const; void setWeight(float weight); std::string toString(); }; } // CIST2362 #endif //LESSON_5_PROGRAMMING_ASSIGNMENT_PERSON_H (PersonExceptions.cpp) #include "PersonExceptions.h" namespace CIST2362 { // ENTER CODE HERE } // CIST2362 (PersonExceptions.h) #ifndef LESSON_5_PROGRAMMING_ASSIGNMENT_PERSONEXCEPTIONS_H #define LESSON_5_PROGRAMMING_ASSIGNMENT_PERSONEXCEPTIONS_H #include <exception> namespace CIST2362 {
  • 8. class badHeight: public std::exception { public: // ENTER CODE HERE }; class badWeight: public std::exception { public: // ENTER CODE HERE }; } // CIST2362 #endif //LESSON_5_PROGRAMMING_ASSIGNMENT_PERSONEXCEPTIONS_H 14.16 CIST2362 Programming Project: Processing a Vector of People This program allows users to input person data, storing that data in a vector. Then after the last person the program outputs the person data. The data collected for each person is first and last name, date of birth as month, day, and year, and the weight and height. Ex: if input is: the output is: |Anne|Niebuhr|Febraury 15, 1996 5.7 feet|104.9 lbs| |Jesse|Choi|December 4, 1962| 5.1 feet|161.9 lbs| This is what will happen if all the data is entered correctly. However, your program should use exceptions to potential input errors: - if the month is out of range 1 to 12 , your exception should produce the message: Invalid Month assigned - must be 1 to 12 - if the day is out of range of 1 to 31, your exception should produce the message: Invalid Day assigned - must be 1 to 31 - if the year is a negative value, your exception should produce the message: Invalid Year assigned - must be a positive number - if the height is negative, your exception should produce the message: Invalid Height assigned - must be a positive number - if the weight is negative, your exception should produce the message: Invalid Weight assigned - must be a positive number In order to get this program working properly, you will need to insert missing code in all of the files. There are quite a few files, but take it one at a time. Remember, there are quite a few unit tests to test your classes before you need to get the main working. Take advantage of this to incrementally build and test your classes. Also, remember that you can build stubs that will allow you to compile the program until you are able to completely fill in the code. Note that this program makes use of Namespaces. You are expected to explicitly use the namespaces versus employing the "using" statement. This means you will have code like std: : cin that says you are referencing cin from the standard namespace. The other namespace you will have in this program is the CIST2362 namespace. All of the classes in your program belong to this namespace, and so you will see CIST2362: : Person referring to the Person class in the CIST2362 namespace. Namespaces are covered in Chapter 9 if you need to refer back.