Concept explainers
File Filter
A file filter reads an input file, transforms it in some way, and writes the results to an output File. Write an abstract file filter class that defines a pure virtual function for transforming a character. Create one derived class of your file filter class that performs encryption, another that transforms a file to all uppercase, and another that creates an unchanged copy of the original file. The class should have the following member function:
void doFilterfifstream &in, ofstream &out)
This function should be called to perform the actual filtering. The member function for transforming a single character should have the prototype:
char transformfehar ch)
The encryption class should have a constructor that takes an integer as an argument and uses it as the encryption key.
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
HEAT+MASS TRANSFER:FUND.+APPL.
SURVEY OF OPERATING SYSTEMS
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Modern Database Management
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out With Visual Basic (8th Edition)
- debugarrow_forwardFirst programming homework Create a class of records for a gradebook called Rec. The data should be private, and should include a firstname, lastname, array of three grades, and a field for average grade. Build two constructors: a default constructor and a constructor that takes the first and last name. Build a function to read the data, either from a file or from cin. The read function reads the two names and three grades, but does not read the average grade. Build a write function that writes the data either to a file or to cout. The write function prints all of the data on one line with spaces between fields. Build a function to calculate the average grade field. Build an overloaded operator == to compare two records. This should be implemented as a friend function. Declare the constructors and functions in the body of the class, but implement them outside the class. I will provide you with a driver called hw1.cpp in ~cthorpe/public/142 and with a test file HW1.txt in the same…arrow_forwardA file filter reads an input file, transforms it in some way, and writes the results to an output file. Write an abstract file filter class that defines a pure virtual function for transforming a character. Create one subclass of your file filter class that performs encryption, another that transforms a file to all uppercase, and another that creates an unchanged copy of the original file. The class should have a member function void doFilter(ifstream &in, ofstream &out)that is called to perform the actual filtering. The member function for transforming a single character should have the prototypechar transform(char ch)The encryption class should have a constructor that takes an integer as an argument and uses it as the encrytion key.arrow_forward
- Assignment Submission Instructions:This is an individual assignment – no group submissions are allowed. Submit a script file that contains the SELECT statements by assigned date. The outline of the script file lists as follows:/* ******************************************************************************** * Name: YourNameGoesHere * * Class: CST 235 * * Section: * * Date: * * I have not received or given help on this assignment: YourName * ***********************************************************************************/USE RetailDB;####### Tasks: Write SQL Queries ######### -- Task 1 (Customer Information):-- List your SELECT statement below. Make sure the SQL script file can be run successfully in MySQL and show the outcome of the code on MySQLarrow_forwardPROGRAMMING LANGUAGE: C++ Implement another class with name UniversityClass which is composed of one teacher and multiple students(use student array) as data members. Another data member of UniversityClass is CourseName that is just a string data member. Write a function in UniversityClass to take Teacher Name, Student names and course name from user. Insert these records in a text file and print screenshot of that text file. Print UniversityClass code here. Print main function here. Print screenshot of text file here.arrow_forwardSample run: Your 1st vector contains the following elements January February March April May June July August September October November December Your 2nd vector contains the following elements May June Julyarrow_forward
- Java Problem The teacher at a school needs help grading an exam with a number of True/False questions. The students’ IDs and test answers are stored in a file. The first entry of the file contains the answer to the test in the form: TTFTFTTTFTFTFFTTFTTF Every other entry in the file is the student’s ID, followed by a blank, followed by the students’ response. For instance, the entry: ABC54102 T FTFTFTTTFTTFTTF TF The student’s ID is ABC54102, answer to question 1 is True, the answer to question 3 is False. Also, the student did not answer question 2 and question 18. The exam has 20 questions. Here is the grading policy: each correct answer is awarded two points, each wrong answer get -1 point, and no answer gets 0 point. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score (total points), followed by the test grade. Assume the following grade scale will be used: 90%-100%, A; 80%-89.99%, B; 70%-79.99%,…arrow_forwardPut the class definition in EV.h and the implementation of the constructors and functions in EV.cpp 1. Define a class called "EV", that represents the information of an electric vehicle. The EV is defined with these attributes: model (string), range(int), unit (string) and year (int). Functions of the EV class must perform the following operations: 1. A default constructor which sets all the numeric instance variables to zero. 2. A constructor with 4 parameters which sets the 4 instance variables to the corresponding values passed. 3. Implement a getter function for each of the 4 instance variables that will return the value of the instance variable. For example, the getX() function for the instance variable model must be called getModel(). 4. Implement a setter function for each instance variable that will assign to the instance variable to the value passed. For example, the setX() function for the instance variable model must be called setModel(). 5. An info function: this function…arrow_forwardc++ ▪ Create Class Student Using header and cpp file (.h & .cpp). ▪Data Members: Name , ID and GPA. ▪Member Functions: DisplayStudentDetails >> this function prints the Name, ID and GPA of the studentarrow_forward
- CLASSES, DYNAMIC ARRAYS AND POINTERS Define a class called textLines that will be used to store a list of lines of text (each line can be specified as a string). Use a dynamic array to store the list. In addition, you should have a private data member that specifies the length of the list. Create a constructor that takes a file name as parameter, and fills up the list with lines from the file. Make sure that you set the dynamic array to expand large enough to hold all the lines from the file. Also, create a constructor that takes an integer parameter that sets the size of an empty list. in C++ Write member functions to: remove and return the last line from the list add a new line onto the end of the list, if there is room for it, otherwise print a message and expand the array empty the entire list return the number of lines still on the list take two lists and return one combined list (with no duplicates) copy constructor to support deep copying remember the destructor!arrow_forwardPart II: Image Representation An image is an array, or a matrix, of pixels (picture elements) arranged in columns and rows. RGB is one of the models used in color pixels. In a color image, each RGB pixel is an integer number which contains the mixture of red, green and blue colors. In this assignment, you will be provided with an image data file, image.dat. The first line in data file contains the height (rows) and width (columns) of the image. The following lines gives the red, green and blue color integer values for each pixel. The following sample.dat is given as an example: (The given example can be seen on the picture down) According to this input file, the image has 4 rows and 2 columns. The pixel at [0][0] has red value 117, green value 117 and blue value 245. Write a Java program that reads from the given input file and creates an RGB image object with the given width and height. Then, it'll read red, green and blue color values for each pixel from data file, and calculate RGB…arrow_forwardC++ I cannot run the code. Please help me fix it. Below is the requirement of the code. Design and write a C++ class that reads text, binary and csv files. The class functions: Size: Returns the file sizeName: Returns the file nameRaw: Returns the unparsed raw data (use vector here to get the unparsed raw data)Parse: A external function to Parse the data. The function accepts the raw data and returns the data parsed by the function. This type of function is called a "Call-Back Function". A Call-Back is necessary for each file as each file requires different regular expressions to parse. With binary files, need to use RegEx to do the parse(). [My code doesn't have this part] Please refer to the Callback.cpp example on how to setup a Call-Back. CallBack.cpp: #include <string>#include <functional>#include <iostream>#include <vector>using namespace std; string ToLower(string s){ string temp; for (char c : s)…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr