Starting Out With C++: Early Objects (10th Edition)
Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 9, Problem 14PC
Program Plan Intro

                Using Files-Birthday Look Up

Program Plan:

  • Include the required header files.
  • Create a class named “Birthday”.
  • Inside the “private” access specifier, declare the variables “name” and “birthday”.
  • Declare a variable “TOTAL” as “10”.
  • Declare function prototype.
  • Define the “main()” function.
    • Create an array object for class.
    • Call the function “getBirthdate()” function to read the birthday date from the file.
    • Call the function “display()” to display  the date in ascending order.
    • Call the function “getResponse()” to get the response from the user .
    • Call the function “Sort_selection()” function to sort the birth date.
    • Call the function “find_date()” to print the corresponding name and date.
  • Function definition for the function “getBirthdate()”.
    • Create an object to read input from the file.
    • Open the file and test that it opened correctly.
    • Checking condition for opening the file.
      • Print the statement.
        • Otherwise, read the data form the file.
          • Read the name from the file.
          • Read the birthday date from the file.
        • Close the file.
  • Function definition for the function “sort_selection ()”.
    • Variable to store the start value and the minimum birthday date index.
    • Create an object for class.
    • Variable to store the minimum date value.
    • Iterate from“start” until it reaches “(TOTAL-1)”
      • Assign “start” to “ind_val”
      • Assign “frds_date[start].birthday” to “min”
      • Iterate from “index” until it  reaches the “TOTAL”.
      • Compare data in the birthday fields
      • Swap records in “frds_date[start]” and “array[ind_val]”.
  • Function definition for the function “display()”.
    • Iterate from the “position” until it reaches the “TOTAL”.
      • Set the precision for name and birthday date.
  • Function definition for function “getResponse()”.
    • Variable to hold the user response.
    • Get the response from the user.
    • Check the response for validation.
      • Validate the user response.
        • Return the response.
  • Function definition for “find_date()”.
    • Print the corresponding name and birthday date.

Blurred answer
Students have asked these similar questions
Date Printer Write a program that reads a char array from the user containinga date in the form mm/dd/yyyy. It should print the date in the form March 12, 2014.
The variables numberArray1 and numberArray2 reference arrays that have 100 elements each. Write code that copies the values from numberArray1 to numberArray2
Hands-On Activities Hands-On Activity 10-1 Write a pseudocode program that creates an array, prompts the user to enter five cities, and displays the array's contents. The contains five elements. Use a For loop to prompt the user to enter cities, and then use another For loop to display the contents. Save the file as cityArray.txt. array

Chapter 9 Solutions

Starting Out With C++: Early Objects (10th Edition)

Ch. 9.6 - Prob. 9.11CPCh. 9.6 - Prob. 9.12CPCh. 9.6 - Prob. 9.13CPCh. 9.6 - Prob. 9.14CPCh. 9.6 - Prob. 9.15CPCh. 9 - Prob. 1RQECh. 9 - Prob. 2RQECh. 9 - Prob. 3RQECh. 9 - Prob. 4RQECh. 9 - Prob. 5RQECh. 9 - Prob. 6RQECh. 9 - Prob. 7RQECh. 9 - A binary search will find the value it is looking...Ch. 9 - The maximum number of comparisons that a binary...Ch. 9 - Prob. 11RQECh. 9 - Prob. 12RQECh. 9 - Bubble sort places ______ number(s) in place on...Ch. 9 - Selection sort places ______ number(s) in place on...Ch. 9 - Prob. 15RQECh. 9 - Prob. 16RQECh. 9 - Why is selection sort more efficient than bubble...Ch. 9 - Prob. 18RQECh. 9 - Prob. 19RQECh. 9 - Prob. 20RQECh. 9 - Prob. 21RQECh. 9 - Charge Account Validation Write a program that...Ch. 9 - Lottery Winners A lottery ticket buyer purchases...Ch. 9 - Lottery Winners Modification Modify the program...Ch. 9 - Batting Averages Write a program that creates and...Ch. 9 - Hit the Slopes Write a program that can be used by...Ch. 9 - String Selection Sort Modify the selectionSort...Ch. 9 - Binary String Search Modify the binarySearch...Ch. 9 - Search Benchmarks Write a program that has at...Ch. 9 - Sorting Benchmarks Write a program that uses two...Ch. 9 - Sorting Orders Write a program that uses two...Ch. 9 - Ascending Circles Program 8-31 from Chapter 8...Ch. 9 - Modified Bin Manager Class Modify the BinManager...Ch. 9 - Using Files-Birthday List Write a program that...Ch. 9 - Prob. 14PCCh. 9 - Using Files-String Selection Sort Modification...Ch. 9 - Using Vectors String Selection Sort Modification...
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,