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 15, Problem 6PC
Program Plan Intro
Removal of Line Breaks
- Include the required header files to the program.
- Definition for filter class.
- In public, declare the function for “do_Filter()”.
- In protected, declare the function for “transform(char ch)”.
- Include the required function prototypes.
- Function definition of the function “do_Filter()”.
- Declare the variable "letter" to get the character stored in the file.
- Loop to check the end of file.
- Output the characters to the file.
- Get the character from the input file.
- Derived class “Line_Break”.
- In protected, define the “transform ()” function.
- Inside the function return the value to the function.
- In public, declare the “do_Filter ()” function.
- In protected, define the “transform ()” function.
- Definition of “do_Filter ()” function.
- Check the input file contains the line breaks.
- If so, removal the line breaks and adds a space between the each word.
- Otherwise, call the “transform ()” function.
- Declare the “File_print()” function.
- Check the input file contains the line breaks.
- Define the main() function.
- Declare the require variable to hold the input and output file.
- Get the file name from the user.
- Create an object for the input file.
- Check the file open condition using “while” loop.
- Exit the program for invalid filename.
- Call the function “File_print()”.
- Get the output file name from the user.
- Create an object for the output file.
- Check the file open condition using “while” loop.
- Exit the program for invalid filename.
- Creating an object for “Line_Break ()”.
- Close output file.
- Re open the file to print the content.
- Close all files.
- Function definition for the function “File_print()”.
- Clear the content of the file.
- Seek arbitrary position in the file.
- Loop to check the end of file.
- Print the character.
- Clear the content of the file.
- Seek arbitrary position in the file
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
class BinaryImage:
def __init__(self):
pass
def compute_histogram(self, image):
"""Computes the histogram of the input image
takes as input:
image: a grey scale image
returns a histogram as a list"""
hist = [0]*256
return hist
def find_otsu_threshold(self, hist):
"""analyses a histogram it to find the otsu's threshold assuming that the input hstogram is bimodal histogram
takes as input
hist: a bimodal histogram
returns: an optimal threshold value (otsu's threshold)"""
threshold = 0
return threshold
def binarize(self, image):
"""Comptues the binary image of the the input image based on histogram analysis and thresholding
take as input
image: an grey scale image
returns: a binary image"""
bin_img = image.copy()
return…
List collection views of a map interface
data structures in java
Chapter 15 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 15.3 - Prob. 15.1CPCh. 15.3 - Prob. 15.2CPCh. 15.3 - What will the following program display? #include...Ch. 15.3 - What will the following program display? #include...Ch. 15.3 - What will the following program display? #include...Ch. 15.3 - What will the following program display? #include...Ch. 15.3 - How can you tell from looking at a class...Ch. 15.3 - What makes an abstract class different from other...Ch. 15.3 - Examine the following classes. The table lists the...Ch. 15 - A class that cannot be instantiated is a(n) _____...
Ch. 15 - A member function of a class that is not...Ch. 15 - A class with at least one pure virtual member...Ch. 15 - In order to use dynamic binding, a member function...Ch. 15 - Static binding takes place at _____ time.Ch. 15 - Prob. 6RQECh. 15 - Prob. 7RQECh. 15 - Prob. 8RQECh. 15 - The is-a relation between classes is best...Ch. 15 - The has-a relation between classes is best...Ch. 15 - If every C1 class object can be used as a C2 class...Ch. 15 - A collection of abstract classes defining an...Ch. 15 - The keyword _____ prevents a virtual member...Ch. 15 - To have the compiler check that a virtual member...Ch. 15 - C++ Language Elements Suppose that the classes Dog...Ch. 15 - Will the statement pAnimal = new Cat; compile?Ch. 15 - Will the statement pCreature = new Dog ; compile?Ch. 15 - Will the statement pCat = new Animal; compile?Ch. 15 - Rewrite the following two statements to get them...Ch. 15 - Prob. 20RQECh. 15 - Find all errors in the following fragment of code,...Ch. 15 - Soft Skills 22. Suppose that you need to have a...Ch. 15 - Prob. 1PCCh. 15 - Prob. 2PCCh. 15 - Sequence Sum A sequence of integers such as 1, 3,...Ch. 15 - Prob. 4PCCh. 15 - File Filter A file filter reads an input file,...Ch. 15 - Prob. 6PCCh. 15 - Bumper Shapes Write a program that creates two...Ch. 15 - Bow Tie In Tying It All Together, we defined a...
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
- Java Objects and Linked Data: Select all of the following statements that are true. The Java Class Library's class ArrayList implements the LinkedList interface. In Java, when one reference variable is assigned to another reference variable, both references then refer to the same object. In Java, the "equals"-method that any object inherits can be overwritten to compare objects field by field.arrow_forwardWhat criteria should be used to evaluate an ArrayList's performance?arrow_forwardJava Programming Define a class CollectionBooks. This class has a data member list of type Book using the ArrayList collection. Define method add. This method add the any object to list. Define printAll. This method display all the added object in the list. Define printAll. This method display all the added object in the list. · Define int count. This method returns the number of objects added in the list. Define Book search(Object e). This method returns the object being search if not found return null. Define void remove(int index). This method remove the object in a list Add a main method with the following menu:1 – Add 2 – Count 3 – Print4 – Search 5 – Delete 6 - Exitarrow_forward
- Doctor -signature:String -doctorID:int - medicine:Arraylist +Doctor(signature:String,doctorID:int) +PrescribeMedicine():void + salary () +checkRecords():void Medicine Pharmacist -medName:String -startTime:int -dosage :int -endTime:int -date_prescribed:int - medicine:Arraylist +Medicine(medName:String,-dosage :int,date_prescribed:int) +Pharmacist (startTime:int,endTime:int) +checkForConflict():double +confirm_prescription():String +getStartTime():int +getEndTime():int +setStartTime(time:int):void +setEndTime(time1:int).voidarrow_forwardSubject-Object oriented programing Write a program which:• creates a new Array List• adds 5 decimal numbers to it• prints the list to the screen In the same program, replace the element in the ArrayList at index 2 by null. Print the resulting list tothe screen.arrow_forwardgui ava - explain what this lone of code means void overrideProgramParameters (Map<String, String> clientParameters, ValueBean valueBean) ;arrow_forward
- What is the difference between an ArrayList object and a Vector object?arrow_forwardC++ ProgrammingActivity: Deque Linked List Explain the flow of the code not necessarily every line, as long as you explain what the important parts of the code do. The code is already correct, just explain the flow. #include "deque.h" #include "linkedlist.h" #include <iostream> using namespace std; class DLLDeque : public Deque { DoublyLinkedList* list; public: DLLDeque() { list = new DoublyLinkedList(); } void addFirst(int e) { list->addAt(e,1); } void addLast(int e) { list->addAt(e,size()+1); } int removeFirst() { return list->removeAt(1); } int removeLast() { return list->removeAt(size()); } int size(){ return list->size(); } bool isEmpty() { return list->isEmpty(); } // OPTIONAL: a helper method to help you debug void print() {…arrow_forwardUsing C++ Without Using linked lists: Create a class AccessPoint with the following: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overLap that checks if two access points overlap their coverage and returns true if they do. Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Represent this with bars like, IIIII. Each bar can represent 20% Test your class by writing a main function that…arrow_forward
- struct nodeType { int infoData; nodeType * next; }; nodeType *first; … and containing the values(see image) Using a loop to reach the end of the list, write a code segment that deletes all the nodes in the list. Ensure the code performs all memory ‘cleanup’ functions.arrow_forwardin python class name: Runner function within a class: def __getitem__(self, lhs: Union[int. list[bool]]) -> Union[float, Runner]: The function should take a list[bool] and will return a new Runner object containing only the filtered values Example : c = Runner([1.0, 2.0, 3.0, 4.0, 2.0, 1.0]) filter = c > 2.0 print(filter) # Output: [False, True, True, False, False]) d = c[filter] print(d) # Output: Runner([3.0, 4.0])arrow_forwardion C Lons Employee -id: int -name String - dob : Date -staff : ArrayList +setid(int): void +getld() : int +setName(String): void +setDob(Date) : void +getDob(): Date +addStaff(Employee) : void +getStaff() : ArrayListarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT