Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 19, Problem 9PC
Program Plan Intro
Cousins
Program Plan:
- Include all the required header files.
- Add enum for a range of values of Gender.
- Define class person.
- Define all the required variables along with their data types.
- Assign the name and gender of a person using functions string getName()and Gender getGender().
- Function to add child of a person Person *addChild is created.
- Function to add parents of a person void addParent is created.
- Function to get number of children of a person and return the number of children is created.
- Function to create a child with specified name and gender, and set one of the parents to this child Person *Person::addChild is called.
- Function to add siblings and step siblings of a given person to a
vector void addSiblings is created. - Function to add cousins of the person void addCousins is called.
- Define the main function.
- Add children of Adam and Amelia.
- Add Children of Amelia and Alan.
- Add Children of Alan and Anna.
- Add cousins from third generations.
- Find the cousins of at least two people, here consider Peter and Paul and find their cousins and display them.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Exercise, maxCylinderVolume
F# system function such as min or methods in the list module such as List.map are not allowed
Write a function maxCylinderVolume that takes a list of floating-point tuples that represent dimensions of a cylinder and returns the volume of the cylinder that has the largest volume. Each tuple has two floating point values that are both greater than zero. The first value is the radius r and the second value is the height h. The volume of the cylinder is computed using ??2h. The value π is represented in F# with System.Math.PI. If the list is empty, return 0.0.
Examples:
> maxCylinderVolume [(2.1, 3.4); (4.7, 2.8); (0.9, 6.1); (3.2, 5.4)];;val it : float = 194.3137888> maxCylinderVolume [(0.33, 0.66)];;val it : float = 0.2257988304
in c++
C++ Struct Pointers Help: I have a file called names.txt. Write a program that reads each line and then store the name and nickname under an individual pointer to the class Person.
names.txt:
Norman, Normie
Justine, Jussy
Richard, Dick
Shelley, Shell
class Person {
public:
string name;
string nickname;
Person(string name, nickname) {
this->name=name;
this->nickname = nickname;
}
};
Print out each pointer's name and nickname to verify that it has been stored.
Chapter 19 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 19.1 - Prob. 19.1CPCh. 19.1 - Prob. 19.2CPCh. 19.1 - Prob. 19.3CPCh. 19.1 - Prob. 19.4CPCh. 19.1 - Prob. 19.5CPCh. 19.1 - Prob. 19.6CPCh. 19.2 - Prob. 19.7CPCh. 19.2 - Prob. 19.8CPCh. 19.2 - Prob. 19.9CPCh. 19.2 - Prob. 19.10CP
Ch. 19.2 - Prob. 19.11CPCh. 19.2 - Prob. 19.12CPCh. 19 - Prob. 1RQECh. 19 - Prob. 2RQECh. 19 - Prob. 3RQECh. 19 - Prob. 4RQECh. 19 - Prob. 5RQECh. 19 - Prob. 6RQECh. 19 - Prob. 7RQECh. 19 - Prob. 8RQECh. 19 - Prob. 9RQECh. 19 - Prob. 10RQECh. 19 - Prob. 11RQECh. 19 - Prob. 12RQECh. 19 - Prob. 13RQECh. 19 - Prob. 14RQECh. 19 - Prob. 15RQECh. 19 - Prob. 16RQECh. 19 - Prob. 17RQECh. 19 - Prob. 18RQECh. 19 - Prob. 19RQECh. 19 - Prob. 20RQECh. 19 - Prob. 1PCCh. 19 - Prob. 2PCCh. 19 - Prob. 3PCCh. 19 - Prob. 4PCCh. 19 - Prob. 5PCCh. 19 - Prob. 6PCCh. 19 - Prob. 7PCCh. 19 - Prob. 8PCCh. 19 - Prob. 9PCCh. 19 - Prob. 10PC
Knowledge Booster
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
- struct Node { int data; Node * next; }; Node • head; a. Write a function named addNode that takes in a variable of type int and inserts it at the head of the list. b. Write a function named removeNode that removes a node at the head of the list.arrow_forwardpointers as Arguments:In the C programming language there is no pass-by-reference syntax to passa variable by reference to a function. Instead a variable is passed by pointer(just to be confusing, sometimes passing by pointer is referred to as pass byreference). This Practice Program asks you to do the same thing as C.Here is the header for a function that takes as input a pointer to an integer:1. void addOne (int ∗ptrNum )Complete the function so it adds one to the integer referenced by ptrNum.Write a main function where an integer variable is defined, give it an initialvalue, call addOne, and output the variable. It should be incremented by 1.arrow_forwardPROGRAMMING LANGUAGE: C++ Write a program which has a class named FileHandlerto read StudentName, MarksObtained from the attached picture. The class should have a function which calculates grade for a student and then adds it in a new column i.e. Grade. The grade should be calculated considering the following criteria. A: 87-100, B+: 80-86, B: 72-79, C+: 66-71, C: 60-65, D: 50-59, F: 0-49 The file should be saved once grade for all students is calculated. Write the driver program for executing the task.arrow_forward
- Create a soda beverage shopping cart program using C++ implementing the following: Linked List - this will be used as the user's cart. This is where the items that the user will purchased are stored here before checking them out. Array - use arrays to store user's stored products. Pointers Functions - Make sure that the rogram will have user-defined functions (e.g.: function for adding nodes, function for displaying the cart, etc.) The program must have a menu where the user can select an action (e.g. Select product, View cart, Check out, etc.) Soda options: Coca-Cola, Pepsi, Sprite, Royal, Mountain Dew Must implement Developer name before the program exits. Please show the entire code and final output.arrow_forwardCreate a soda beverage shopping cart program using C++ implementing the following: Linked List - this will be used as the user's cart. This is where the items that the user will purchased are stored here before checking them out. Array - use arrays to store user's stored products. Pointers Functions - Make sure that the rogram will have user-defined functions (e.g.: function for adding nodes, function for displaying the cart, etc.) The program must have a menu where the user can select an action (e.g. Select product, View cart, Check out, etc.) Soda options: Coca-Cola, Pepsi, Sprite, Royal, Mountain Dew Tabular Format: In the table, you must include the code for each soda options, their price and quantity The program must look like this: Hi! Welcome to ABC GoDrink! Here are the drinks that we offer: CODE PRODUCT SRP a Coca-Cola 24.99 b Pepsi 22.99 c Royal 24.99 d Sprite 24.99 e Mountain Dew 22.99 Menu Select a product. View My Cart and Proceed to Check-Out…arrow_forwardC++arrow_forward
- TRUE OR FALSE: In C++, comments that begin with the "multi-line" comment symbol can't be nested. A member function of a class has access to only the public data members of the class. If a C++ function does not take any parameters, parenthesis around the empty parameter list are still required. The size of a pointer variable depends on the type that it is pointing to.arrow_forwardFunction 1: draw_subregion Complete the implementation of draw_subregion. This function has the following parameters: my_turtle: A turtle object (which will do the drawing) polygon_points: A list of (x, y) points (i.e. a list of tuples) that defines the points of a polygon. This function should make the turtle draw the polygon given by the points. Make sure that you lift your pen before heading to the first point. You should also make sure you return to the very first point at the end (i.e. you will go to the first point in the list two times: once at the beginning, and once at the end). Language Pythonarrow_forward// This program reads floating point data from a data file and places those // values into the private data member called values (a floating point array) // of the FloatList class. Those values are then printed to the screen.// The input is done by a member function called GetList. The output// is done by a member function called PrintList. The amount of data read in // is stored in the private data member called length. The member function// GetList is called first so that length can be initialized to zero.#include <iostream>#include <fstream>#include <iomanip> using namespace std;const int MAX_LENGTH = 50; // MAX_LENGTH contains the maximum length of our list class FloatList // Declares a class that contains an array of// floating point numbers{ public:void getList(ifstream&); // Member function that gets data from a file void printList() const;// Member function that prints data from that // file to the screen.FloatList();// constructor that sets length to…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage