C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 14, Problem 14.10E

Write a series of statements that accomplish each of the following. Assume that we've defined class Person that contains the private data members
char lastName[15];
char firstName [10]:
int age;
int id;
and public member functions
// accessor functions for id
void set Id(int);
int getId() const;
// accessor functions for lastName
void setLastName (const string&);
string getLastName() const;
// accessor functions for firstName
void setFirstName(const string&);
string getFirstName() const;
// accessor functions for age
void setAge (int);
int getAge() const;
Also assume that any random-access files have been opened properly.

  1. Initialize nameage.dat with 100 records that store values lastName =”unassigned”, firstName = “” and age = 0.
  2. Input 10 last names, first names and ages, and write them to the file,
  3. Update a record that already contains information. If the record does not contain information, inform the user "No info".
  4. Delete a record that contains information by reinitializing that particular record.

Blurred answer
Students have asked these similar questions
C++ Personal Information Class: Design a class that holds the following personal data: name, age, and phone number. Write appropriate accessor and mutator functions. Demonstrate the class by writing a program that creates three instances of it. One instance should hold your information, and the other two should hold your friend's or family member's information.
Programming Exercise 11-2 dateType.h file provided   #ifndef date_H  #define date_H   class dateType { public:     void setDate(int month, int day, int year);       //Function to set the date.       //The member variables dMonth, dDay, and dYear are set        //according to the parameters       //Postcondition: dMonth = month; dDay = day;       //               dYear = year      int getDay() const;       //Function to return the day.       //Postcondition: The value of dDay is returned.     int getMonth() const;       //Function to return the month.         //Postcondition: The value of dMonth is returned.     int getYear() const;       //Function to return the year.            //Postcondition: The value of dYear is returned.     void printDate() const;       //Function to output the date in the form mm-dd-yyyy.     bool isLeapYear();       //Function to determine whether the year is a leap year.     dateType(int month = 1, int day = 1, int year = 1900);       //Constructor to…
Language=C++ Create an employee class. The member data should comprise an int for storing the employee number and a float for storing the employee’s compensation. Member functions should allow the user to enter this data and display it. Write a main() that allows the user to enter data for three employees and display it (Use Array of objects).
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
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
What is Abstract Data Types(ADT) in Data Structures ? | with Example; Author: Simple Snippets;https://www.youtube.com/watch?v=n0e27Cpc88E;License: Standard YouTube License, CC-BY