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 asser7

1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdfasser7
 
1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdf1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdfasser7
 
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdfasser7
 
1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdf1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdfasser7
 
1- Remember that enzymes (biological catalysts) are most often ______-.pdf
1- Remember that enzymes (biological catalysts) are most often ______-.pdf1- Remember that enzymes (biological catalysts) are most often ______-.pdf
1- Remember that enzymes (biological catalysts) are most often ______-.pdfasser7
 
1- Pick any current Canadian political party of your choice (whether i.pdf
1- Pick any current Canadian political party of your choice (whether i.pdf1- Pick any current Canadian political party of your choice (whether i.pdf
1- Pick any current Canadian political party of your choice (whether i.pdfasser7
 
1- Research Certificate based authentication techniques -& research On.pdf
1- Research Certificate based authentication techniques -& research On.pdf1- Research Certificate based authentication techniques -& research On.pdf
1- Research Certificate based authentication techniques -& research On.pdfasser7
 
1- What is the history and evolution of government involvement in heal.pdf
1- What is the history and evolution of government involvement in heal.pdf1- What is the history and evolution of government involvement in heal.pdf
1- What is the history and evolution of government involvement in heal.pdfasser7
 
1- What is the difference between a cell membrane and a cell wall- Des.pdf
1- What is the difference between a cell membrane and a cell wall- Des.pdf1- What is the difference between a cell membrane and a cell wall- Des.pdf
1- What is the difference between a cell membrane and a cell wall- Des.pdfasser7
 
14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdf
14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdf14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdf
14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdfasser7
 
14-) Which of the following are valid variable names in Python- Give a.pdf
14-) Which of the following are valid variable names in Python- Give a.pdf14-) Which of the following are valid variable names in Python- Give a.pdf
14-) Which of the following are valid variable names in Python- Give a.pdfasser7
 
14-3- Give some examples of how technology is creating employer-employ.pdf
14-3- Give some examples of how technology is creating employer-employ.pdf14-3- Give some examples of how technology is creating employer-employ.pdf
14-3- Give some examples of how technology is creating employer-employ.pdfasser7
 
1-The substantia nigra resides within this brain region- 2-Complex spi.pdf
1-The substantia nigra resides within this brain region- 2-Complex spi.pdf1-The substantia nigra resides within this brain region- 2-Complex spi.pdf
1-The substantia nigra resides within this brain region- 2-Complex spi.pdfasser7
 
1-The substantia nigra resides within this brain region- 2-Complex sp.pdf
1-The substantia nigra resides within this brain region-  2-Complex sp.pdf1-The substantia nigra resides within this brain region-  2-Complex sp.pdf
1-The substantia nigra resides within this brain region- 2-Complex sp.pdfasser7
 
1- Which of the following will promote variation in a species- I- Meio.pdf
1- Which of the following will promote variation in a species- I- Meio.pdf1- Which of the following will promote variation in a species- I- Meio.pdf
1- Which of the following will promote variation in a species- I- Meio.pdfasser7
 
11- Use the simulator to create the entangled state 2101+2110-.pdf
11-  Use the  simulator to create the entangled state 2101+2110-.pdf11-  Use the  simulator to create the entangled state 2101+2110-.pdf
11- Use the simulator to create the entangled state 2101+2110-.pdfasser7
 
10- Two types of chemical bonding are shown in Figure 22- In the figur.pdf
10- Two types of chemical bonding are shown in Figure 22- In the figur.pdf10- Two types of chemical bonding are shown in Figure 22- In the figur.pdf
10- Two types of chemical bonding are shown in Figure 22- In the figur.pdfasser7
 
101051010.pdf
101051010.pdf101051010.pdf
101051010.pdfasser7
 
19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdf
19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdf19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdf
19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdfasser7
 
11- Daniel ordered 200 computer components from Muthu- Each component.pdf
11- Daniel ordered 200 computer components from Muthu- Each component.pdf11- Daniel ordered 200 computer components from Muthu- Each component.pdf
11- Daniel ordered 200 computer components from Muthu- Each component.pdfasser7
 

More from asser7 (20)

1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
 
1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdf1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdf
 
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
1-)Review Exhibit 14-2- How could the concept of addressable TV advert.pdf
 
1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdf1-) What are the eight subfields of physical geography and what do the.pdf
1-) What are the eight subfields of physical geography and what do the.pdf
 
1- Remember that enzymes (biological catalysts) are most often ______-.pdf
1- Remember that enzymes (biological catalysts) are most often ______-.pdf1- Remember that enzymes (biological catalysts) are most often ______-.pdf
1- Remember that enzymes (biological catalysts) are most often ______-.pdf
 
1- Pick any current Canadian political party of your choice (whether i.pdf
1- Pick any current Canadian political party of your choice (whether i.pdf1- Pick any current Canadian political party of your choice (whether i.pdf
1- Pick any current Canadian political party of your choice (whether i.pdf
 
1- Research Certificate based authentication techniques -& research On.pdf
1- Research Certificate based authentication techniques -& research On.pdf1- Research Certificate based authentication techniques -& research On.pdf
1- Research Certificate based authentication techniques -& research On.pdf
 
1- What is the history and evolution of government involvement in heal.pdf
1- What is the history and evolution of government involvement in heal.pdf1- What is the history and evolution of government involvement in heal.pdf
1- What is the history and evolution of government involvement in heal.pdf
 
1- What is the difference between a cell membrane and a cell wall- Des.pdf
1- What is the difference between a cell membrane and a cell wall- Des.pdf1- What is the difference between a cell membrane and a cell wall- Des.pdf
1- What is the difference between a cell membrane and a cell wall- Des.pdf
 
14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdf
14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdf14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdf
14- What is Big-O notation- Give example algorithm for O(1)-O(n)-O(log.pdf
 
14-) Which of the following are valid variable names in Python- Give a.pdf
14-) Which of the following are valid variable names in Python- Give a.pdf14-) Which of the following are valid variable names in Python- Give a.pdf
14-) Which of the following are valid variable names in Python- Give a.pdf
 
14-3- Give some examples of how technology is creating employer-employ.pdf
14-3- Give some examples of how technology is creating employer-employ.pdf14-3- Give some examples of how technology is creating employer-employ.pdf
14-3- Give some examples of how technology is creating employer-employ.pdf
 
1-The substantia nigra resides within this brain region- 2-Complex spi.pdf
1-The substantia nigra resides within this brain region- 2-Complex spi.pdf1-The substantia nigra resides within this brain region- 2-Complex spi.pdf
1-The substantia nigra resides within this brain region- 2-Complex spi.pdf
 
1-The substantia nigra resides within this brain region- 2-Complex sp.pdf
1-The substantia nigra resides within this brain region-  2-Complex sp.pdf1-The substantia nigra resides within this brain region-  2-Complex sp.pdf
1-The substantia nigra resides within this brain region- 2-Complex sp.pdf
 
1- Which of the following will promote variation in a species- I- Meio.pdf
1- Which of the following will promote variation in a species- I- Meio.pdf1- Which of the following will promote variation in a species- I- Meio.pdf
1- Which of the following will promote variation in a species- I- Meio.pdf
 
11- Use the simulator to create the entangled state 2101+2110-.pdf
11-  Use the  simulator to create the entangled state 2101+2110-.pdf11-  Use the  simulator to create the entangled state 2101+2110-.pdf
11- Use the simulator to create the entangled state 2101+2110-.pdf
 
10- Two types of chemical bonding are shown in Figure 22- In the figur.pdf
10- Two types of chemical bonding are shown in Figure 22- In the figur.pdf10- Two types of chemical bonding are shown in Figure 22- In the figur.pdf
10- Two types of chemical bonding are shown in Figure 22- In the figur.pdf
 
101051010.pdf
101051010.pdf101051010.pdf
101051010.pdf
 
19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdf
19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdf19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdf
19- Ski Quarterly typically sells subscriptions on an annual basis- an.pdf
 
11- Daniel ordered 200 computer components from Muthu- Each component.pdf
11- Daniel ordered 200 computer components from Muthu- Each component.pdf11- Daniel ordered 200 computer components from Muthu- Each component.pdf
11- Daniel ordered 200 computer components from Muthu- Each component.pdf
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
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
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
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
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
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
 
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
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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 ...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
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
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

#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.