Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 15, Problem 14PC
Program Plan Intro
Bank Accounts
Program plan:
Savings.h:
- Include the required header files.
- Define a class for “saving”
- In protected, declare the required variable.
- In public, declare a constructor and declare the functions “withdraw()”, “deposit()” and “monthlyProc()” function.
Savings.cpp:
- Function definition for the “withdraw()”of savings class..
- Check whether the status is “false”.
- Display the statement.
- Check whether the amount is less than 0
- Check the condition for deactivation.
- Check the condition or withdraw amount.
- Make a call to the function “withdraw()”
- Check whether the status is “false”.
- Function definition for the “deposit()”of savings class..
- Check the “bal” is greater than 25.
- Assign the “status” to “true”.
- Make a call to the base class function “deposit()”.
- Check the “bal” is greater than 25.
- Function definition for the “monthlyProc()” of savings class.
- Check whether the “withdraw_amt” is greater than 4.
- Calculate the service charge.
- Call the function “monthlyProc()”.
- Call the function “getMonthlyStats()”
- Check whether the “withdraw_amt” is greater than 4.
Checking.cpp:
- Function definition for the “withdraw()” of checking class.
- Check whether the status is “false”.
- Display the statement.
- Check whether the amount is less than 0
- Check the condition for deactivation.
- Check the condition or withdraw amount.
- Make a call to the function “withdraw()”
- Check whether the status is “false”.
- Function definition for the “deposit()”of checking class..
- Check the “bal” is greater than 25.
- Make a call to the base class function “deposit()”.
- Check the “bal” is greater than 25.
- Function definition for the “monthlyProc()”of checking class..
- Check whether the “withdraw_amt” is greater than 4.
- Calculate the service charge.
- Call the function “monthlyProc()”.
- Call the function “getMonthlyStats()”
- Check whether the “withdraw_amt” is greater than 4.
Checking.h:
- Define the “ Checking.h”.
- In public, declare the base class constructor.
- Declare the functions “withdraw()”, “deposit()” and “monthlyProc()”.
Account.h:
- Define the “Account.h”.
- In protected, declare the required variables.
- In public, invoke the constructor. And declare the functions “withdraw()”, “deposit()” and “monthlyProc()”.
Account.cpp:
- Create a constructor “Account()” and initialize the variables.
- Function definition for “deposit()” of Account class.
- Add the “amount” with the “bal” amount.
- Increment the “dep_amt”.
- Function definition for “withdraw” of Account class.
- Subtract the “amount” with the “bal” amount.
- Increment the “withdraw_amt”.
- Function definition for “calcInt()”.
- Calculate the monthly interest rate.
- Add the “mon_interest” with “bal” amount.
- Function definition for “monthlyProc()”.
- Call the function “calcInt()”.
- Subtract the “ser_charge” with “bal”.
- Function definition for “getMonthlyStats()”.
- Display the withdraw amount, deposit amount, service charges and ending balance.
Soruce.cpp:
- Include the required header files.
- Define the main() function,
- Include the required function prototype to the program.
- Create an object for savings and checking.
- Declare a variable to hold the user choice.
- Display the menu options.
- Validate the menu options.
- Execute the user’s choice.
- Use switch for selecting options.
- Case 1:
- Get the deposits amount.
- Call the “deposit()” from the savings class.
- Case 2:
- Get the deposits amount.
- Call the “deposit()” from the checking class.
- Case 3:
- Get the withdraw amount.
- Call the “withdraw()” from the saving class.
- Case 4:
- Get the withdraw amount.
- Call the “withdraw()” from the checking class.
- Case 5:
- Call the “ignore()” then call the “monthlyProc()” from the savings class.
- Call the “get()” then call the “monthlyProc()” from the checking class.
- Case 1:
- Include the required function prototype to the program.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Object oriented programming
Intellij
The programmer constructs a class to isolate the functionality of an implementation from the kind of data utilized in it. As a result, every data type may be accommodated by functions and classes. o file with headers o technique that is virtual O design template a generic class
Language: C++
Imagine that you are in the design stage of a software system for handling the data of the partici-
pants of a major soccer tournament. As different roles will be present (players, coaches, referees,
etc.) you are required to develop a class handling the data of a generic league member. For each
person the following data is at least needed
• first name as character array (36 characters characters including '\ 0')
• last name as character array (36 characters)
• date of birth as character array (11 characters, storage format is yyyy-mm-dd)
In addition the whole team is located somewhere, so location is an additional static prop-
erty of the class.
Design and implement a class for holding these data. In addition add at least two other general
properties to this class.
The class, which will be called TournamentMember, should provide constructors (empty and
parametric), a destructor and also a copy constructor. The class should also provide inline
setter and getter methods…
Chapter 15 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Ch. 15.1 - Here is the first line of a class declaration....Ch. 15.1 - What is the name of the derived class in the...Ch. 15.1 - Suppose a program has the following class...Ch. 15.2 - What is the difference between private members and...Ch. 15.2 - What is the difference between member access...Ch. 15.2 - Suppose a program has the following class...Ch. 15.3 - What will the following program display? #include...Ch. 15.3 - What will the following program display? #include...Ch. 15.7 - Explain the difference between overloading a...Ch. 15.7 - Prob. 15.10CP
Ch. 15.7 - Prob. 15.11CPCh. 15.7 - What will the following program display? #include...Ch. 15.7 - What will the following program display? #include...Ch. 15.7 - What will the following program display? #include...Ch. 15.7 - What will the following program display? #include...Ch. 15.8 - Does the following diagram depict multiple...Ch. 15.8 - Does the following diagram depict multiple...Ch. 15.8 - Examine the following classes. The table lists the...Ch. 15.8 - Examine the following class declarations: class...Ch. 15 - What is an is a relationship?Ch. 15 - A program uses two classes: Dog and Poodle. Which...Ch. 15 - How does base class access specification differ...Ch. 15 - What is the difference between a protected class...Ch. 15 - Can a derived class ever directly access the...Ch. 15 - Which constructor is called first, that of the...Ch. 15 - What is the difference between redefining a base...Ch. 15 - Prob. 8RQECh. 15 - What is an abstract base class?Ch. 15 - A program has a class Potato, which is derived...Ch. 15 - What base class is named in the line below?class...Ch. 15 - What derived class is named in the line below?...Ch. 15 - What is the class access specification of the base...Ch. 15 - What is the class access specification of the base...Ch. 15 - Protected members of a base class are like...Ch. 15 - Complete the table on the next page by filling in...Ch. 15 - Complete the table below by filling in private,...Ch. 15 - Complete the table below by filling in private,...Ch. 15 - A derived class inherits the ________ of its base...Ch. 15 - When both a base class and a derived class have...Ch. 15 - An overridden base class function may be called by...Ch. 15 - When a derived class redefines a function in a...Ch. 15 - A(n) __________ member function in a base class...Ch. 15 - ________ binding is when the compiler binds member...Ch. 15 - __________ binding is when a function call is...Ch. 15 - _________ is when member functions in a class...Ch. 15 - When a pointer to a base class is made to point to...Ch. 15 - A(n) __________ class cannot be instantiated.Ch. 15 - A(n) _______ function has no body, or definition,...Ch. 15 - A(n) _________ of inheritance is where one class...Ch. 15 - _______ is where a derived class has two or more...Ch. 15 - In multiple inheritance, the derived class should...Ch. 15 - Write the first line of the declaration for a...Ch. 15 - Write the first line of the declaration for a...Ch. 15 - Suppose a class named Tiger is derived from both...Ch. 15 - Write the declaration for class B. The classs...Ch. 15 - T F The base classs access specification affects...Ch. 15 - T F The base classs access specification affects...Ch. 15 - T F Private members of a private base class become...Ch. 15 - T F Public members of a private base class become...Ch. 15 - T F Protected members of a private base class...Ch. 15 - T F Public members of a protected base class...Ch. 15 - T F Private members of a protected base class...Ch. 15 - T F Protected members of a public base class...Ch. 15 - T F The base class constructor is called after the...Ch. 15 - T F The base class destructor is called after the...Ch. 15 - T F It isnt possible for a base class to have more...Ch. 15 - T F Arguments are passed to the base class...Ch. 15 - T F A member function of a derived class may not...Ch. 15 - Prob. 51RQECh. 15 - T F A base class may not be derived from another...Ch. 15 - class Car, public Vehicle { public: Car(); Car();...Ch. 15 - class Truck, public : Vehicle, protected {...Ch. 15 - class SnowMobile : Vehicle { protected: int...Ch. 15 - class Table : public Furniture { protected: int...Ch. 15 - class Tank : public Cylinder { private: int...Ch. 15 - class Three : public Two : public One { protected:...Ch. 15 - Employee and ProductionWorker Classes Design a...Ch. 15 - ShiftSupervisor Class In a particular factory, a...Ch. 15 - TeamLeader Class In a particular factory, a team...Ch. 15 - Prob. 4PCCh. 15 - Time Clock Design a class named TimeClock. The...Ch. 15 - Essay Class Design an Essay class that is derived...Ch. 15 - PersonData and CustoraerData Classes Design a...Ch. 15 - PreferredCustomer Class A retail store has a...Ch. 15 - File Filter A file filter reads an input file,...Ch. 15 - File Double-Spacer Create a derived class of the...Ch. 15 - Course Grades In a course, a teacher gives the...Ch. 15 - Ship. CruiseShip, and CargoShip Classes Design a...Ch. 15 - Pure Abstract Base Class Project Define a pure...Ch. 15 - Prob. 14PC
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
- CPU Scheduling Algorithm Simulator in C++Instructions:Create a .zip file consisting of code, output files, readme file .The readme file should explain briefly your code. The simulator will consists of following classes:(i) Process: The data members of this class should store process id, arrival time in the ready queue,CPU burst time, completion time, turn around time, waiting time, and response time. The memberfunctions of this class should assign values to the data members and print them. A constructorshould also be used.(ii) Process_Creator: This class will create an array of processes and assign a random arrival timeand burst time to each process. Data members, constructor and member functions can be writtenaccordingly.(iii) Scheduler: This class will implement the scheduling algorithm. The class will maintain a readyqueue of infinite capacity (i.e., any number of processes can be accommodated in the queue). Theready queue should be implemented using the min-Heap data structure…arrow_forwardProblem 2: Route Planning You are on the development team for a Route Planning application. The team has already developed a class named NavigatorApp for storing and displaying the graph representing the road network. This class has a void displayShortestPath() function which takes the source and destination vertices of the trip and displays the shortest route between them. Using the strategy pattern, draw a class diagram of the system which will allow for the NavigatorApp to display the shortest driving, walking, or cycling route when the displayShortestPath() function is called. You can assume that another developer is in charge of making sure the appropriate strategy is correctly set and for calling the displayShortestPath() function Starter code /* Modify NavigatorApp (if necessary) */ class NavigatorApp { private: Graph map; public: void displayMap(Window * window); void displayShortestPath(Vertex source, Vertex destination, Window * window); /* write pseudo code for this function…arrow_forwardWrite JAVA code General Problem Description: It is desired to develop a directory application based on the use of a double-linked list data structure, in which students are kept in order according to their student number. In this context, write the Java codes that will meet the requirements given in detail below. Requirements: Create a class named Student to represent students. In the Student class; student number, name and surname and phone numbers for communication are kept. Student's multiple phones number (multiple mobile phones, home phones, etc.) so phone numbers information will be stored in an “ArrayList”. In the Student class; parameterless, taking all parameters and It is sufficient to have 3 constructor methods, including a copy constructor, get/set methods and toString.arrow_forward
- To separate the implementation's functionality from the kind of data it uses, the programmer creates a class. Functions and classes can handle any data type because of this. headers in a file a method that is not real As a generic class, a design template isarrow_forwardWritten in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forwardObject Oriented Programming C++ Write a program that defines a class with a data member to holds a “serial number” for each object created from the class. That is, the first object created will be numbered 1, the second 2, and so on. To do this, you’ll need another data member that records a count of how many objects have been created so far. (This member should apply to the class as a whole; not to individual objects. What keyword specifies this?) Then, as each object is created, its constructor can examine this count member variable to determine the appropriate serial number for the new object. Add a member function that permits an object to report its own serial number. Then write a main() program that creates three objects and queries each about its serial number. They should respond I am object number 2, and so on.arrow_forward
- DATA STRUCTURESPLS HELParrow_forwardc++ questionarrow_forwardQuestion Object Oriented Programming c++ Write a program that defines a class with a data member to holds a "serial number" for each object created from the class. That is, the first object created will be numbered 1, the second 2, and so on. To do this, you'll need another data member that records a count of how many objects have been created so far. (This member should apply to the class as a whole; not to individual objects. What keyword specifies this?) Then, as each object is created, its constructor can examine this count member variable to determine the appropriate serial number for the new object. Add a member function that permits an object to report its own serial number. Then write a main() program that creates three objects and queries each about its serial number. They should respond I am object number 2, and so on.arrow_forward
- Programming Assignment Containers are used to store objects of the same type and provide operations with which these objects can be managed. These operations include object insertion, deletion, and retrieval. Memory is allocated for containers dynamically at runtime. Containers thus provide a safe and easy way to manage collections of objects. The C++ standard library provides various class templates for container management in the Containers Library. These classes can be categorized as follows: Sequential containers, where the objects are arranged sequentially and access to an object can either be direct or sequential. Associative containers, where the objects are generally organized and managed in a tree structure and can be referenced using keys. Sequential Containers Sequential containers are distinguished by the operations defined for them, which are either generic or restricted. Restricted operations, such as appending at the end of a container, have constant…arrow_forwardProgramming language : c++ Question : Make a class Student with attributes StudentName, Enrollment, semester, section, course MarksObtained and Grade. Write appropriate constructors, get and set functions for data members. The data member grade is automatically calculated based on marks obtained out of 100 for each course.arrow_forwardJAVA CODEarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,