Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the C++ code using Microsoft visualstudio and follow the instructions carefully:- CSIS 223 Object-Oriented Programming with C++ Lab03 -DateStructure Date Structure (Record) Create a

Write the C++ code using Microsoft visualstudio and follow the instructions carefully:-
image text in transcribed
image text in transcribed
CSIS 223 Object-Oriented Programming with C++ Lab03 -DateStructure Date Structure (Record) Create a Windows console program named Labb3-DateStructure in a suitable folder. Do not create a separate directory for the solution. Copy the completed version to H:ICSIS223 and turn in a copy of the entire program folder on drive X: when that drive becomes available The program defines the dateType structure to hold an entered current date and each prompted birth date. Three function prototypes are given. Implement these functions after main(). Code main() routine below struct dateType int month; int day int year l function prototypes dateType getDate) bool isEligible(int currage, char sex); int main) // prompt for month, day, year ll pass entered DOB and date today geInYears (dateType birthDate, dateType today); eligibility based on age and gender dateType currDate; dateType dob; char gender; int Il structure to store today's date Il structure to store each date of birth age; &input cout gender ll prompt for gender code M/F // input gender code (first instance) !-4') entered to signal Quit while != Q' && gender (gender gender toupper(gender); cout > gender /l prompt for gender code M/F // input gender code (next instance cout >inputDate.month continue with prompts and input for day and year return inputDate; int ageInYears(dateType birthDate, dateType today) int calcAge; Code algorithm to calculate age based on difference between two dates (both passed in date Type structure). Subtract birth year from current year giving calcAge. if current month is less than birth month, teter monts (1-321 Enter day of mo teter year as vwy: 2019 subtract 1 from calcAge else if current month is equal to birth month, ender Rvt -Quits: if current day of current month is less than birth month birth day value date of sBirth Enter menth 11-12 2 subtract 1 from calcAge. return calcAge; Enter year eswY: 1954 dender: Age: 65Eigiele bool isEligible(int currAge, char sex) bool elig false; Determine eligibility (true or false) based on age and gender values passed to boolean routine. Male applicants are eligible if age is 65 or greater. Female applicants are eligible at age 62 or greater Return true eligibility value if applicant is eligible Enter montn [1-12]:2 Enter day of month6 Enter year as ww:1954 Gender1 M A 64 Not E3igible ender RuF-QQuitSi Enter date of brth Enter nonth [1-12): 2 Enter day of monthI Enter year as Yww 1957 Gender: , Age: 62 return elig; Code the three value-returning functions outlined above. Each function returns a specific value of its declared data type - a date Type structure, an integer, and a boolean value. Code each function so that it sets the proper value for the data type returned. nter date of birth .. Enter month (1-12]: 2 Enter day of month: 6 Enter year as WWY: 1957 Gender: Age: 61 Not Eligiale Test your program to see if a 65-year-old male and a 62-year-old female are correctly processed exactly on their eligible birthday, on the day before, and on the day after the eligible birthday

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions