1. Modules a) Create a file userFunctions.py: 1. Copy nameFormat(), createUser(), and printUser) from the problems above into the userFunctions.py file. 2. Modify nameFormat() to accept only two parameters first and last. Change last to an optional parameter. This function should now return either first or last, first. 3. Define a function printUsers() which accepts a list parameter users. This function calls the printUser function to print all user data. b) Create a separate file, functionModule.pv:
Q: Write a program to calculate the net pay of an employee. Input the basic pay, pass basic pay to user…
A: #include<iostream.h>#include<conio.h> class Employee{ char emp_name[30]; int…
Q: Assuming default declaration types for all variables. A file has the following data: 2 4…
A: According to the information given:- We have to find out what will be the output.
Q: 7- There are important differences between values that are printed and output values. Consider the…
A: a. f(1) We are sending 1 as argument to function f and then inside the function we are displaying…
Q: UNIX Systems Programming A UNIX user is trying to write a short function to automate figuring out…
A: Line no 8 may contain following code num_lines=$( lines_in_file $1 )
Q: B. Using Pool0 do the following: 3.1. The pool must have 2 processes, each process will pass two…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.…
Q: 4. Consider the following file access matrix:- File 2 File 4 File 1 File 3 Account I Account 2 Own…
A: Given:
Q: 7- There are important differences between values that are printed and output values. Consider the…
A: Task : In the given question , the code for the three functions is given below. The task is to find…
Q: Create a new file (in Dev C++) and save it as lab11_XYZ.cpp (replace XYZ with your initials). Create…
A: This C++ program contains header file swap_XYZ.h and cpp file lab11_XYZ.cppswap functions for int,…
Q: 1. In indexed file allocation method, assuming that the block can only store 8 pointers as shown in…
A: File Allocation Methods: An allocation method is to tell how the disk blocks are allocated for a…
Q: 1. write a perl script to implement head command. a) The script should read the file name from…
A: The perl script is given by #save first arguement to f$f=$ARGV[0];#save number of arguements to…
Q: Program specifications: Write a function called rCopy that copies the entire contents of one file…
A: Program plan: Create the object of the file for input and output stream. Open the input and output…
Q: Program Specifications Write a function called rCopy that copies the entire contents of one file to…
A: I have designed and developed the program for the given question Assuming that it is to be written…
Q: Q2: Suppose that the file (employee.txt) shown in the figure was stored in the default path, the…
A: Required:
Q: Program Specifications Write a function called rCopy that copies the entire contents of one file to…
A: I have designed and developed the program for the given question Assuming that it is to be written…
Q: Problem 3. Write a function, called problem3() which takes a file name, ie. data.txt, on input. The…
A: Below is the required C++ program: -
Q: Modify the following program by use functions fgetc and fputs rather than getchar and puts. The…
A: Modified program is attached in next step
Q: python only*** define the following functions; Function 1. writeStringToFile(fileName, text): This…
A: Create three functions WriteStringToFile(), readFirstLines(), WriteLines() in python. In…
Q: Design and implement an experiment to test the performance of read and write functions. Write a…
A: Design and implement an experiment to test the performance of read and write functions. Write a…
Q: Write a void function that will merge the contents of two text files containing the chemical…
A: This question is solved by C languages Programming. Program Plan :- merge2binary.c Define a…
Q: 2. Using the algorithm developed above, create a function that determines the status of the first…
A: Create a text file. file.txt contains:
Q: 3. Filename: assign4-11.py Modify the assign1-4 script by adding a function calcinterest (). The…
A: Input : Input Principle, rate, number of payments, and number of years. Output : Return of…
Q: C++ program Write a CPP program to do the following: Read the attached text file…
A: #include<iostream>#include<fstream>#include<string.h>using namespace std;int…
Q: 1. What are different file stream classes? Explain the syntax of opening the file in read and write…
A: There are mainly 3 file stream classes ofstream This represents the output file stream and is…
Q: e a python script(.py file) that contains a function to import each file type .csv, .txt, .json, and…
A: Step 1: Below the python code that import file type .csv .txt .json . and xlsx Utilize the if…
Q: Program Specifications Write a function called rCopy that copies the entire contents of one file to…
A: I have designed and developed the program for the given question Assuming that it is to be written…
Q: Given matrix A and vector b write a function file that returns f = A*b and a matrix B where B has…
A: Find the java code to do so attached.
Q: 1. Write a function that reads any text file with a given filename and returns the count of a unique…
A: CODE : import string #importing string library from nose.tools import assert_equal ,…
Q: Write a function that generates a file with following parameters: def fillFile(fileSize, fileName):…
A: I will be using python to solve this question. Please thumbs up if i am able to help you :-)
Q: Write a function definition called, sigma, that takes an input file reference and two integer…
A: answer: writing this code in java : main function:public static void main(String[] args) {…
Q: Write a function that accepts the name of a file as it's only argument. The function should open the…
A: The following are steps need to be taken for the given program: Using the open() function, for…
Q: Q4: a- suppose that the file (delta.txt) shown in the figure was stored in the default path, this…
A: The delta.txt file should contain value separated by spaces. Last values in each row show also have…
Q: Assume that there is a valid file cards.txt in the current directory which contains 5 valid int…
A: #include <iostream>#include <fstream> using namespace std; void printSevens(); int…
Q: 18 1. Match the following with respect to file operations i). ii). iii) iv) Read a. read from the…
A: A file is a group of related information that is stored on the storage, i.e. secondary storage in…
Q: Write a function to output patient information that are stored in a file. One of the parameters of…
A: Since the to be used is not specified we will write the program in the python. Let us consider that…
Q: a) Describe two member functions that are known as extraction operator that are commonly used in…
A:
Q: 2. Using the algorithm developed above, create a function that determines the status of the first…
A: The function status of return type void and four parameters can be defined to find the status of…
Q: Part 1: Write regular expression to validate the pattem of a website URL. A valid URL starts by http…
A: Answer
Q: 5. a. Create a text file named employee.dat containing the following data: Anthony A 10031 11.82…
A: a. Program: //including necessary header files #include<iostream> #include<fstream>…
Q: Do not copy paste from any source else downvote Write a void function that will merge the contents…
A: Given: Write a void function that will merge the contents of two text files containing chemical…
Q: a. Create a text file named employee.dat containing the following data: Anthony A 10031 11.82…
A: a. Program: //including necessary header files #include<iostream> #include<fstream>…
Q: Write a function called process_data that meets the specification written below. Your method should…
A: Given that write a function called process_data that meets the specifications written below. your…
Q: Q.3 Explain following file handling functions with examples: i) feof() ii) ferror() iii) ftell() iv)…
A: 1) feof() : it test the end-of-file indicator for the given stream. int feof(FILE *stream) : it…
Q: Create a new file (in Dev C++) and save it as lab11_XYZ.cpp (replace XYZ with your initials). Create…
A: Program:Filename: lab11_XYZ.cpp// header files #include <iostream> #include "swap_XYZ.h" using…
Q: 1. Write a function that reads any text file with a given filename and returns the count of a unique…
A: Below I have provided Python Programming. Also, I have attached the screenshot of the code and…
Q: Question 4: Complete the below function that takes a file name and a list as arguments and reads the…
A:
Q: Modify the following program by use functions fgetc and fputs rather than getchar and puts. The…
A: Note: The question and the code given seems to have no connection. So, I wrote the code for the…
Q: Assuming a file consists of fixed-length logical records, whose type is defined as t_record. The…
A: For Read t_record*read(int n) { Int i; t_record*p; reset(); for (i=0, I< (n-1);i++){ p =…
need help with python.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Write a function that accepts names of two files: source and target as arguments and copies alternate characters from the source file to the target file. The function should return -1 if the source file does not exist.3. Write a function which reads an already existing file “File1.txt” and write digits (0-9) in to a new text file “mynumber.txt” and non digits into a file “Text.txt”.in c++1. Consider the following incomplete C++ program: #include int main() { … } a. Write a statement that includes the header files fstream, string, and iomanip in this program. b. Write statements that declare inFile to be an ifstream variable and outFile to be an ofstream variable. c. The program will read data from the file inData.txt and write output to the file outData.txt. Write statements to open both of these files, associate inFile with inData.txt, and associate outFile with outData.txt. d. Suppose that the file inData.txt contains the following data: Giselle Robinson Accounting 5600 5 30 450 9 75 1.5 The first line contains a person's first name, last name, and the department the person works in. In the second line, the first number represents the monthly gross salary, the bonus (as a percent), and the taxes (as a percent). The third line contains the distance traveled and the traveling time. The fourth line contains the number of coffee cups sold and the cost of each coffee cup. Write statements so that after the program executes, the contents of the file outData.txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results. Name: Giselle Robinson, Department: Accounting Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00, Taxes: 30.000 Paycheck: $4116.00 Distance Traveled 450.00 miles, Traveling Time: 9.00 hours Average Speed: 50.00 miles per hour Number of coffee Cups Sold: 75, Cost: $1.50 per cup Sales Amount = $112.50 e. Write statements that close the input and output files. f. Write a C++ program that tests the statements in parts a through e.
- Examine the following three functions that take as argument a file name and return the extension of that file. For instance, if the file name is 'myfile.tar.gz' the returned value of the function should be 'gz'. If the file name has no extention, i.e. when the file name is just 'myfile', the function should return an empty string. def get_extension1(filename): return(filename.split(".")[-1]) def get_extension2(filename): import os.path return(os.path.splitext(filename)[1]) def get_extension3(filename): return filename[filename.rfind('.'):][1:] Which of the these functions are doing exactly what they are supposed to do according to the description above? get_extension3 only get_extension2 only None of them. get_extension1 onlyChoose the correct answer after considering the following statements: I. A using namespace directive should never be in a .cpp file because that .cpp file could be included in another source file. II. A using namespace directive should always be used in a .h files. III. Namespaces help differentiate functions, variables, and types with the same name. Group of answer choices a. Only III are true b. Only II and III are true c. Only I is true d. Only I and III is true e. Only II is trueWrite a C++ function (along with helper functions if required) that takes a file stream as a parameter and prints out the maximum negative number in the given file. Do not need to write the main function. An example: [Example file contents] 4 -2 8 12 -8 9 3Prints: Maximum Negative number -2
- Write a function void saveByDept(char *fileName, char *deptName , student allStudents[], int size) that will save the information of all students who belong to the department with name pointed to by deptNameinto a text file. The name of the file is given as an input parameter, fileNameWrite a function to output patient information that are stored in a file. One of the parameters of the function must be no. of patients to output and another one the name of the file where the patients’ information is stored.C# please Write a program that will create file with at least 10 lines. Each line of your file should have information delimited by some delimiter (I.e., commas, spaces, slashes, symbols, etc.). After your file has been created with the proper amount of data, you should read your file line by line and display without the delimiters in the same program after closing your writer. Additionally, the information stored into your file should be data that is gathered from a separate class. Your program should save your file in a specific directory. To promote flexibility, your program should check to see if the chosen directory exists prior creating it, and if it does not exist, your program should create it for you. Additionally, you should allow the user to enter the names of the directory and file instead of hard-coding it into your program.
- 2. For reading and for processing data of employee records stored in a file named employee.txt,the contents of it need to be reversed from end to beginning. Write a C program to read a file in serial way, and reverse the contents of the employee record and then, again traverse and read the record in the newly reversed file.Write a function definition called, sigma, that takes an input file reference and two integer references as its parameters. The function should read the numbers from a file, calculate their total value (cumulative sum), find the largest, and smallest numbers in the file. The function should return the cumulative sum, the largest, and the smallest values to the calling function. Note: the function reads the entire file.1-) Write a code to do following operationsa-print the contents of filewrite a function to print the contents of a given file on screen. Your function prototypeshould be in given format.void PrintFileContent(FILE* fptr)b-copy contents of one file to another filewrite a function to copy contents of one file to another file. Convert all characters intouppercase while copying the content. You are allowed to use toupper() function in ctypelibrary. Your function prototype should be in given format.void copy_file(FILE* fptr1,FILE* fptr2)c- count the Number of Characters in a Filewrite a function to count the Number of Characters in a File. Your function prototypeshould be in given format.int findNumberofChar(FILE* fptr)Please design your main.c file as follow1- Open a text file to read in your directory.2- Create an empty text file for writing and reading in same directory.3- Check if both files are opened.4- Print the contents of first file by calling PrintFileContent function.5- Call…