Question No.7: A formatted file master.txt contains the employee code, name and basic pay of employees of an organization. Write a program to calculate the D.A(dearness allowance), H.R.A (House rent allowance) and gross income of each employee and store employee code, name, basic pay, D.AHR.A and gross income to the file emp.txt, where D.A is the 32% of basic pay, H.R.A is 15% of basic pay and gross pay is the sum of basic pay, D.A and H.R.A.
Q: text file called attendance.txt which records the student daily attendance for Class A and B. Day…
A: c is having in built functions to open a file in read and write mode. We just need to use fopen…
Q: QUESTION 30 Write a Python function which will find the longest word in a file. The name of the file…
A: Required:
Q: Question No.7: A formatted file master.txt contains the employee code, name and basic pay of…
A: Actually, program is a executable software that runs on a computer.
Q: HW4: Write a function to count the number of blank spaces in a text file named "input.txt"
A: Step 1: Initialize count to 0. Step 2: Open the input file. Step 3: Read a line of text. Step 4:…
Q: Please code in python Write a function to diaply the total word count in a file. Input parameter…
A: 1) Below is program to define a function to display the total word count in a file It defines a…
Q: Write a program that will find the largest age in the following file. Assume that ”name and age” is…
A: Programming instructions: Open the file to calculate the number of records in the file. Close the…
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: Given an input file (numbers.txt) that contains one integer on each line. Read all the numbers and…
A: When we consider C++ program , it can be defined as a collection of objects that communicate via…
Q: Create a new file (in Dev C++) and save it as lab12_XYZ.cpp (replace XYZ with your initials). Create…
A: Program://Filename: lab12_XYZ.cpp#include<iostream> #include <iomanip> #include…
Q: Write a C program that reads real numbers from a data file named "numbers.txt", one-by-one. For…
A: Initially save the input and output files(numbers.txt,Results.txt) FILE SCREENSHOT 1. numbers.txt…
Q: 1. Declare a file pointer called input. Open a file called location.txt for reading using this…
A: Declare structure name Location and array of that structure. Start : 1)declare file pointer name…
Q: QUESTION 2 When using the "with..as" formulation to open a file, the file is automatically closed…
A: Answer: True
Q: Problem 17.2 Write a py-file to determine all integers n between 1 and 101 for which f (n)=0.75" –…
A: We need to use if loops to check if divisible or not and f(n)>189. For power we can use **.
Q: Given the following data definitions: int t1 = 44; double t3 = -9.25; string ts = "UOB 2021";…
A: C++ provides some classes to perform output and input of characters to files. ofstream : Stream…
Q: 4- The file Grades.txt contains the grades for the Assignments (column 1), Midterm exam (column 2)…
A: Given:
Q: Let A and B two text files, containing some binary lines between of length 1...N. Where N is the…
A: Python code to compare binary value stored in two different text files
Q: 8.14 LAB: Thesaurus Given a set of text files containing synonyms for different words, complete the…
A: Actually, program is an executable software that runs on a computer.
Q: "### Exercise 2 Working with a file and numbers ###\n", "\n", "The file grades.txt has the grade for…
A: Task : Read the grades from grades.txt. Find the average grade. Show the average grade of the…
Q: A formatted file master.txt contains the employee code, name and basic pay of employees of an…
A: #include <stdio.h> int main(){ int code, count = 0; float basic, hra, da, gross; char…
Q: file containing data about some students' options regarding a set of optional subjects is given. The…
A: To read data from the file #include <stdio.h> int main(void){ char name[50000]; int…
Q: Question 15 What is the syntax for reading a comma separated value (CSV) file? A…
A: Please find the answer below :
Q: 4. Write a program that counts the number of unique words in a text file; use gb.bxt as a test file…
A: The definition of the function readfile() is shown below. def readfile(fname):…
Q: Assume that the following text file is opened in read mode (file mode 'r') to obtain a file object:…
A: Python readline () is a file method that helps to read one complete line from the given file. It has…
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: "### Exercise 2 Working with a file and numbers ###\n", "\n", "The file grades.txt has the grade for…
A: The required python program code by using the file operation is given in the next step.
Q: Write Program in C. A formatted file master.txt contains the employee code, name and basic pay of…
A: note: name of the input file used: example.txt name of the output file used: file.txt change them in…
Q: Question #1 The following program reads integer numbers from a file named numbers.txt. For each…
A: In the given program a data file is read and for every number in the file it is checked for a…
Q: HW1: Write a CPP program that reads items names and items prices of 50 items from KB and stores them…
A: reads items names and items prices of 50 items from KB and stores them in a file (prices.txt)…
Q: (python) Write a function startWith(File, Let) that takes a file name and a letter. Each line in…
A: given data (python) Write a function startWith(File, Let) that takes a file name and a letter. Each…
Q: a) Describe two member functions that are known as extraction operator that are commonly used in…
A:
Q: QUESTION 2 Pointers are never used for pointing to an object O pointing to a variable O pointing to…
A: According to the guidelines we are supposed to answer only one question. SO I am answering the…
Q: quenton Consider the following piece of code that opens a file with file pointer fp, in this file…
A: Here fp is the file pointer and the name and surname are string variables which do not require &…
Q: Part 1: Write regular expression to validate the pattem of a website URL. A valid URL starts by http…
A: Answer
Q: b) What is significance of file pointer in file handling? Consider a following structure Roll. No.…
A: A file pointer indicates the memory location where a file is created and holds records about some…
Q: 22: Write a M-file mat lab program call it Eql.m file to find the followi quation: without using…
A: % Program to compute series y = x/1 + x^2/2! + x^3/3! + ... + x^n/n! % Get value of x x…
Q: 6. a. Write a C++ program that opens a file and displays its contents with line numbers. That is,…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
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: 1. (Practice) Enter the data for the info.txt file in Figure 9.1 or download it from this book’s Web…
A: 1. Yes, the backup file was written. Before executing program: Output:
Q: C++ program to create a new file named “college.txt” to store list of colleges
A: Program: // C++ Version 14#include<iostream>#include<fstream>using namespace std;//…
Q: a. Create a text file named info.dat containing the following data (without the headings): Name…
A: A required C++ program is as follows, File name: “main.cpp” //Include header files #include…
Q: 3. Write a function which reads an already existing file “File1.txt” and write digits (0-9) in to a…
A: The program includes iostream, fstream,string and cctype header files. Declare the variables for…
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: Show the output of the program. Assume that the file txt contains the data shown above…
A:
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 No.7: A formatted file master.txt contains the employee code, name and basic pay of…
A: Program Plan:- Initialize all the header files Enter the path name in place of PATHNAME in the…
Q: Write a C function named void skip_a(FILE *fp,char *in) which prevents to write lower case letter…
A: To solve this we need to loop until we reach the end of the string which is indicated by '\0' and…
Q: Given a set of text files containing synonyms for different words, complete the main program to…
A: Step 1: Prompt and accept the word and the starting letter from the user. Step 2: Open the file that…
Write a C
Step by step
Solved in 4 steps with 3 images
- Question No.7: A formatted file master.txt contains the employee code, name and basic pay of employees of an organization. Write a program to calculate the D.A(dearness allowance), H.R.A (House rent allowance) and gross income of each employee and store employee code, name, basic pay, D.A,H.R.A and gross income to the file emp.txt, where D.A is the 32% of basic pay, H.R.A is 15% of basic pay and gross pay is the sum of basic pay, D.A and H.R.A. Question No.8: Create a structure called Studentsthat holds information like Registration code, name of student and date of admission. Write a program tocreate an array of structures and enter some data into it (15 records at least). Then ask the user to enter current date. Display the names of those Students who are in the school greater than or equal to 5 years.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++Consider the following contents of a text file called attendance.txt which records the student daily attendance for Class A and B. Day ClassA ClassB1 50 382 48 403 44 36 Write C statements to perform the following:-Declare two file pointers named fp1 and fp2. -Open the attendance.txt text file for reading using fp1 file pointer. If the file is not openedsuccessfully, display an error message “File opening errors” and exit the program. -Open the attnAverage.txt text file for writing using fp2 file pointer.
- 7. a. Create a text file named info.dat containing the following data (without theheadings):Name Social Security Number Hourly Rate Hours WorkedB Caldwell 555-88-2222 10.50 37D Memcheck 555-77-4444 12.80 40R Potter 555-77-6666 16.54 40W Rosen 555-99-8888 11.80 35b. Write a C++ program that reads the data file created in Exercise 7a and computes and displaysa payroll schedule. The output should list the Social Security number, name, and grosspay for each person, calculating gross pay as Hourly Rate × Hours Worked.6. a. Write a C++ program that opens a file and displays its contents with line numbers.That is, the program should print the number 1 before displaying the first line, print thenumber 2 before displaying the second line, and so on for each line in the file.b. Modify the program written in Exercise 6a to list the file’s contents on the printer assignedto your computer.7. a. Create a text file named info.dat containing the following data (without theheadings):Name Social Security Number Hourly Rate Hours WorkedB Caldwell 555-88-2222 10.50 37D Memcheck 555-77-4444 12.80 40R Potter 555-77-6666 16.54 40W Rosen 555-99-8888 11.80 35b. Write a C++ program that reads the data file created in Exercise 7a and computes and displaysa payroll schedule. The output should list the Social Security number, name, and grosspay for each person, calculating gross pay as Hourly Rate × Hours Worked.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.
- 10.13 LAB: Thesaurus Given a set of text files containing synonyms for different words, complete the main program to output the synonyms for a specific word. Each text file contains synonyms for the word specified in the file’s name, and each row within the file lists the word’s synonyms that begin with the same letter, separated by a space. The program reads a word and a letter from the user and opens the text file associated with the input word. The program then stores the contents of the text file into a dictionary predefined in the program. Finally the program searches the dictionary and outputs all the synonyms that begin with the input letter, one synonym per line, or a message if no synonyms that begin with the input letter are found. Hints: Use the first letter of a synonym as the key when storing the synonym into the dictionary. Assume all letters are in lowercase. Ex: If the input of the program is: educate c the program opens the file educate.txt, which contains:…A formatted file master.txt contains the employee code, name and basic pay of employees of an organization. Write a program to calculate the D.A(dearness allowance), H.R.A (House rent allowance) and gross income of each employee and store employee code, name, basic pay, D.A,H.R.A and gross income to the file emp.txt, where D.A is the 32% of basic pay, H.R.A is 15% of basic pay and gross pay is the sum of basic pay, D.A and H.R.A. Note: Use C language.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.
- Transcribed Image Text Problem 3) Create a text file that contains the following information: John Doe 2005 124.80 36 Note that the fist line represents the name of the client, the second line represents the year in which the client started an account with this insurance company. The third line represent the monthly payment for the insurance. The fourth line represents the number of months left in the insurance policy. Write a C++ program that will read this file and will display the client's name, the number of years for which this client has been with the company, and the remaining amount they have to payC# 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.Let A and B two text files, containing some binary lines between of length 1...N. Where N is the line with the maximum number of characters, 1 the minimum number of characters in each line. Design a Python3 function to compare each line of the files, character by character, and if there is a match of the characters, create a variable representing the similarity between the lines of each file, and return that similarity variable measures the similarity between two files.