C++: Matching Program   Create a datafile that contains the first name, last name, gender, age, height, smoking preference, eye color and phone number. Add a variety of records to the file. A sample file looks like: Write a program that opens the file and reads the records one by one. The program will skip any records where the gender preference is not a match. Of those records that match the gender preference, check to see if the age and height are between the maximum and minum preferences. Then check to see if the smoking preference and eye color are also a match. If at least 3 of the remaining fields match, consider the record a partial match, and print it in the report. If all 4 of the remaining fields match, the record is a perfect match and print it in the report with an asterisk next to it. At the end of the program, close the file and report how many total records there were of the specified gender, how many were a partial match, and how many were a perfect match. See the sample output below.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

 

C++: Matching Program

 

Create a datafile that contains the first name, last name, gender, age, height, smoking preference, eye color and phone number. Add a variety of records to the file. A sample file looks like:

Write a program that opens the file and reads the records one by one. The program will skip any records where the gender preference is not a match. Of those records that match the gender preference, check to see if the age and height are between the maximum and minum preferences. Then check to see if the smoking preference and eye color are also a match. If at least 3 of the remaining fields match, consider the record a partial match, and print it in the report. If all 4 of the remaining fields match, the record is a perfect match and print it in the report with an asterisk next to it. At the end of the program, close the file and report how many total records there were of the specified gender, how many were a partial match, and how many were a perfect match. See the sample output below.

**Sample Output**

1. **User Input:**
   - What is the gender of your ideal match (M, F, N)? M
   - What is the minimum age? 0
   - What is the maximum age? 100
   - What is the minimum height (in inches)? 0
   - What is the maximum height (in inches)? 100
   - Smoker (Y/N)? N
   - What is the eyecolor (Blue, Green, Grey, Brown)? Brown
   
2. **Output Table:**
   - **Columns:** Name, Age, Height, Smoker, Eye Color, Phone
   - **Rows:**
     - Bobby Singer | 70 | 69 | Y | Brown | 555-867-5309
     - *Dean Winchester | 43 | 72 | N | Brown | 555-867-5309
     - *Sam Winchester | 39 | 75 | N | Brown | 555-867-5309

3. **Results:**
   - There were 2 perfect matches and 1 partial match out of 4 records.

4. **Conclusion:**
   - Program ended with exit code: 0

---

**A run of the program.**

1. **User Input:**
   - What is the gender of your ideal match (M, F, N)? F
   - What is the minimum age? 20
   - What is the maximum age? 65
   - What is the minimum height (in inches)? 60
   - What is the maximum height (in inches)? 70
   - Smoker (Y/N)? Y
   - What is the eyecolor (Blue, Green, Grey, Brown)? Blue

2. **Output Table:**
   - **Columns:** Name, Age, Height, Smoker, Eye Color, Phone
   - **Rows:**
     - *Bela Talbot | 39 | 69 | Y | Blue | 555-867-5309

3. **Results:**
   - There were 1 perfect match and 0 partial matches out of 3 records.
Transcribed Image Text:**Sample Output** 1. **User Input:** - What is the gender of your ideal match (M, F, N)? M - What is the minimum age? 0 - What is the maximum age? 100 - What is the minimum height (in inches)? 0 - What is the maximum height (in inches)? 100 - Smoker (Y/N)? N - What is the eyecolor (Blue, Green, Grey, Brown)? Brown 2. **Output Table:** - **Columns:** Name, Age, Height, Smoker, Eye Color, Phone - **Rows:** - Bobby Singer | 70 | 69 | Y | Brown | 555-867-5309 - *Dean Winchester | 43 | 72 | N | Brown | 555-867-5309 - *Sam Winchester | 39 | 75 | N | Brown | 555-867-5309 3. **Results:** - There were 2 perfect matches and 1 partial match out of 4 records. 4. **Conclusion:** - Program ended with exit code: 0 --- **A run of the program.** 1. **User Input:** - What is the gender of your ideal match (M, F, N)? F - What is the minimum age? 20 - What is the maximum age? 65 - What is the minimum height (in inches)? 60 - What is the maximum height (in inches)? 70 - Smoker (Y/N)? Y - What is the eyecolor (Blue, Green, Grey, Brown)? Blue 2. **Output Table:** - **Columns:** Name, Age, Height, Smoker, Eye Color, Phone - **Rows:** - *Bela Talbot | 39 | 69 | Y | Blue | 555-867-5309 3. **Results:** - There were 1 perfect match and 0 partial matches out of 3 records.
# Matching Program in C++

Create a data file that contains the first name, last name, gender, age, height, smoking preference, eye color, and phone number. Add a variety of records to the file. A sample file looks like:

```
 matches.txt 
-----------------------------------
| Charlie Bradbury | F | 42 | 65 | N | Green | 555-867-5309 |
| Bobby Singer     | M | 38 | 69 | Y | Brown | 555-867-5309 |
| Dean Winchester  | M | 43 | 72 | N | Brown | 555-867-5309 |
| Sam Winchester   | M | 39 | 76 | N | Brown | 555-867-5309 |
| Jody Mills       | F | 37 | 69 | N | Brown | 555-867-5309 |
| Bela Talbot      | F | 31 | 69 | Y | Brown | 555-867-5309 |
| James Novak      | M | 46 | 71 | Y | Blue  | 555-867-5309 |
-----------------------------------
```

Write a program that opens the file and reads the records one by one. The program will skip any records where the gender preference is not a match. Of those records that match the gender preference, check to see if the age and height are between the maximum and minimum preferences. Then check to see if the smoking preference and eye color are also a match. If at least 3 of the remaining fields match, consider the record a partial match, and print it in the report. If all 4 of the remaining fields match, the record is a perfect match and print it in the report with an asterisk next to it. At the end of the program, close the file and report how many total records there were of the specified gender, how many were a partial match, and how many were a perfect match. See the sample output below.
Transcribed Image Text:# Matching Program in C++ Create a data file that contains the first name, last name, gender, age, height, smoking preference, eye color, and phone number. Add a variety of records to the file. A sample file looks like: ``` matches.txt ----------------------------------- | Charlie Bradbury | F | 42 | 65 | N | Green | 555-867-5309 | | Bobby Singer | M | 38 | 69 | Y | Brown | 555-867-5309 | | Dean Winchester | M | 43 | 72 | N | Brown | 555-867-5309 | | Sam Winchester | M | 39 | 76 | N | Brown | 555-867-5309 | | Jody Mills | F | 37 | 69 | N | Brown | 555-867-5309 | | Bela Talbot | F | 31 | 69 | Y | Brown | 555-867-5309 | | James Novak | M | 46 | 71 | Y | Blue | 555-867-5309 | ----------------------------------- ``` Write a program that opens the file and reads the records one by one. The program will skip any records where the gender preference is not a match. Of those records that match the gender preference, check to see if the age and height are between the maximum and minimum preferences. Then check to see if the smoking preference and eye color are also a match. If at least 3 of the remaining fields match, consider the record a partial match, and print it in the report. If all 4 of the remaining fields match, the record is a perfect match and print it in the report with an asterisk next to it. At the end of the program, close the file and report how many total records there were of the specified gender, how many were a partial match, and how many were a perfect match. See the sample output below.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
User Defined DataType
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education