The Directory class has a list of names in it. You should use dynamic memory to create an array upon instantiation. You should create a copy constructor for the directory class and an assignment operator (i.e. operator=()). You should create a function called fillDirectory which accepts a size for the directory and the names for it both of which should be given by the user. In main, create directory1 and fill it with information. Use the assignment operator=() to set directory2 equal to directory1. This is in c++
Q: readEmpFromFile
A: Programming is given below.
Q: Write a function that will receive a pointer to the address of the first element of the array. Read…
A: Include necessary header files. Create function to read the file and return the number of ID Use…
Q: Change main to load employees from a file if a command line argument is given to the program (using…
A: given - Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a…
Q: Write a class Roster that is identified by the course name, course code, number of credits,…
A: #include<iostream> // header file for cout and cin #define MAX_CAPACITY 10 // declaring macro…
Q: modify task6.c to create a tool that remove those files from the current working directory. You can…
A: #include <stdio.h>#include <dirent.h>#include <string.h>#include…
Q: Demonstrate that when a ten element array, a, is passed, if the the called method can change the…
A: Program code: //FilesExercise.javaimport java.io.File;import java.io.FileNotFoundException;import…
Q: My Question starts here In the code linked Implement a function readEmpFromFile that takes a FILE…
A: C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C…
Q: Write a procedure named DumpMemory that encapsulates the DumpMem procedure in theIrvine32 library.…
A: Define the procedure that calls the dump memory procedure in the library. The procedure uses the…
Q: IS Write a function named get_stat whose parameter is an object/dictionary. The parameter's keys are…
A: The required JavaScript function code is provided in the next step. The dot operator is used for…
Q: Pointers may be assigned which of the following values? Select one: a. Any integer values. b. An…
A: Pointer is a variable which is used to store the address of another variable
Q: (A) When you create two object stacks of the same type, they are considered equal if they satisfy…
A: The solution for the above given question is given below:
Q: Use the Bash shell for the completion of this project. Develop a shell scripting application that…
A: Answer :
Q: Create a new file called pointerBasics.cpp. Write a C++ program in this new file. In this new file,…
A: #include<iostream>using namespace std;int main(){ //declaring integer myInt with value 15 int…
Q: 5. Be able to load a FriendsDB from a file. Make a new function, load_friends_database(filename)…
A: Given that, Make a new function, load_friends_database(filename) that creates a new FriendsDB object…
Q: Take a close look at the two codes below: IntCollection.h picture attached IntCollection.cpp :…
A: Given IntCollection.h, IntCollection.cpp, and main.cpp are considered as input. As per requirements…
Q: The movie collection program found below is currently missing two important pieces of…
A: Solution: # Required Python 3 code # scoreEntry Class class ScoreEntry: def __init__(self, name,…
Q: A python dictionary, Bank, is created to keep track of the Current Account and the Savings Account…
A: #function to print the contents of dictionary bank def printBank(): for x, y in Bank.items():…
Q: Write a python program... Write a function called merge1(d1,d2) that takes two dictionaries as…
A: If you want to run the code you can run it on, online GDB compiler for python or you can run it on…
Q: #includeciostream> using namespace std; struct Employee int Id; char Name [25]; int Age; long…
A: This question comes from Computer Programming which is a part of Computer Science. Let's discuss it…
Q: Which function does not return the pointer correctly? The code below calls the getline member…
A: For the given question the correct answer is option 2. The screenshot for the output of option 1 is…
Q: n this exercise, you will write a Point structure that represents a space in two-dimensional space.…
A: the code is an given below : 10,567 answers If you have any doubts, please give me comment...…
Q: Suppose that you have the Object class Employee which is an object that contains Name, Surname and…
A: The program for the above given question is below:
Q: 6. Write a Python function named num_vowels_consonants that is passed a string containing letters,…
A: As per company guideline, I am solving only one question, because these are not interlinked. Please…
Q: Assuming a char requires one byte, an int requires four bytes, and a pointer requires four bytes,…
A: In this question we will understand few questions related to the struct in C program. Where we will…
Q: Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer…
A: // C program #include <stdio.h>#include <stdlib.h>#include <string.h> // a struct…
Q: Create a file named minesweeper.py Create a function that takes a grid of # and -, where each hash…
A: Python code: def count_adjcent_mines(grid): N=len(grid) output=[] for row,inner_list in…
Q: You've been given the task of testing a method called catWhiteSpace in a "Paragraph" object, which…
A: The solution for the above given question is given below:
Q: THIS IS THE REFERNCE FOR COPY: Dictionary a) Define a function createUser() with an arbitrary…
A: THIS IS THE REFERNCE FOR COPY:Dictionarya) Define a function createUser() with an arbitrary…
Q: Write a function that takes (i) a FILE pointer (e.g. FILE *fp) type variable, (ii) an array of…
A: Write a function that takes (i) a FILE pointer (e.g. FILE *fp) type variable, (ii) an array of…
Q: Question Which statement about the memory allocation is incorrect? Releasing memeber through the…
A: Defined the given statement as an incorrect statement
Q: You are to create a database of books that are stored using a vector. Keep track of the author,…
A: You are to create a database of books that are stored using a vector. Keep track of the author,…
Q: Write a Template function body called swap( ) to swap the values of the two values of integer,…
A: The syntax for the template function is shown below. template<class T>return_type…
Q: In C++ Define a class called textLines that will be used to store a list of lines of text (each…
A: Step 1 The code is given in the below step Sometimes copy and paste won't work so please type the…
Q: Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer…
A: #include <stdio.h>#include <stdlib.h>#include <string.h> #define EMPS_SIZE…
Q: Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer…
A: #include <stdio.h>#include <stdlib.h>#include <string.h>#define EMPS_SIZE…
Q: In C++ Write a program that simulates a Magic 8-Ball. Prompt the user for a question, and randomly…
A: A C++ program for the given criteria is as follows,/** * @ file main.cpp * @brief This is the…
Q: void writeEmpToFile(Employee *emp, FILE *f) { fwrite(&emp->salary, sizeof(emp->salary), 1, f);…
A: Since you are asked to write writeEmpToFile() method, I have implemented that function only and…
Q: file operator code 1 // The FileOperator class that includes methods for file input and output 2 //…
A: FileWriter class in Java is used to write character-oriented data to a file. write() method is used…
Q: C++ Write a function named “checkInvalidHours” that accepts an array of PaySub objects and its…
A: The solution in C++ is as follows for size of 5.We can change the size as per our requirement
Q: C++ would you help to write this function. I have it in pseudocode : Function : Reads from file…
A: In the code below ofstream(filename) out defines an output file-stream, it therefore creates a…
Q: Among other things, the purpose of this assignment is to assess the student's ability to write a…
A: Below find the solution The updated code for Proj04Runner.java is as below: import…
Q: Which of the following statement is correct? Destructor destroys only float data members of…
A: Given question are multiple choice selected question.
Q: As discussed in class, using pointers, write a function named xstrrev() to mimic strrev() (click…
A: Below i have written program:
Q: void writeEmpToFile(Employee *emp, FILE *f) { fwrite(&emp->salary, sizeof(emp->salary), 1, f);…
A: Sol: This code is nothing but piece of code and to write employee detail to the file after calling…
Q: Information for 20 customers of a bank is stored in a random Access file named musteri.dat using the…
A: // File Name:CustomerAccount.c #include <stdio.h>#include <stdlib.h>#include…
Q: When does the void pointer can be dereferenced? A.when it doesn't point to any value B.when it…
A: Given To know the condition when void pointer can be dereferenced.
Q: I already have the code for the assignment below, but there is some errors in the code. Please help…
A: Modified code: Item.java: public class Item { private String name, number; public Item(String…
The Directory class has a list of names in it. You should use dynamic memory to create an
array upon instantiation. You should create a copy constructor for the directory class and an
assignment operator (i.e. operator=()). You should create a function called fillDirectory which
accepts a size for the directory and the names for it both of which should be given by the user.
In main, create directory1 and fill it with information. Use the assignment operator=() to set
directory2 equal to directory1.
This is in c++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- My Question starts here In the code linked Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer to a struct employee. This function should read the information from the file (reversing what writeEmpToFile does), create a new employee and fill in the data. If the FILE has no more info (is at end of file), this function should return NULL. This function must also ensure any employee actually created (not the NULL) is added to the array (as is done in createEmployee). Change main to load employees from a file if a command line argument is given to the program (using your readEmpFromFile function you just wrote). Question ends here To make it easier so that you do not have to go through the entire code I'm going to put writeEmpToFile function right here after the question but if you still need to look at the full code to get an understanding of what you are working with its linked at the bottom void writeEmpToFile(Employee *emp, FILE…Write a void function that will merge the contents of two text files containing the chemical elements into a single binary file. The function's parameters will be three file pointers; each text file will contain an integer atomic number followed by the element name, chemical symbol and atomic weight. Here are two sample lines: 11 Sodium Na 22.9920 Calcium Ca 40.08 The function can assume that one file does not two copies of the same elements and that the binary output file should have the same property. IN C PLEASEConsider the Student class in the provided student.py file. Each student has a name, an id anda list of courses taken. A course is represented as a list with three items to indicate the coursename, semester taken and grade. For example, [‘comp1008’, ‘S24’, 76.3] represents this coursewith a final grade of 76.3. Complete all the functions in the provided a4.py file.
- There's an error in the part that "function" was not declared in the code. Can you fix the code? Code: #include <iostream>#include <queue>#include <vector> using namespace std; struct Process { int processId; int burstTime; int priority;}; // Function to calculate average waiting time and average turnaround timevoid calculateAvgTimes(vector<Process>& processes, vector<int>& waitingTimes, vector<int>& turnaroundTimes) { int totalProcesses = processes.size(); int totalWaitingTime = 0; int totalTurnaroundTime = 0; for (int i = 0; i < totalProcesses; i++) { totalWaitingTime += waitingTimes[i]; totalTurnaroundTime += turnaroundTimes[i]; } float avgWaitingTime = (float)totalWaitingTime / totalProcesses; float avgTurnaroundTime = (float)totalTurnaroundTime / totalProcesses; cout << "Average Waiting Time: " << avgWaitingTime << endl; cout << "Average Turnaround Time:…Information for 20 customers of a bank is stored in a random Access file named musteri.dat using the struct given below. struct customer{ int account;char surname[25]; char name[20]; double deposit; }; 1- Write a function having prototype given below that returns how many customers stored in the file whose deposit is less than zero. Call your function from main function within a menu.Function prototype: int listIndebtedAccounts(FILE *); 2- Write a function having prototype given below that returns the customer information as a struct that has maximum amount of money in his account.how many customers stored in the file whose deposit is less than zero. Call your function from main function within a menu.Function prototype: struct customer findMaxDeposit(FILE *); 3- Write a function having prototype given below that transfers all information of customers into a sequential access file named “list.txt” whose deposit is greater than or equal to 300 . Call your function from main…In this final submission, you will build on checkpoint B to load the database and DNA sequence from files. There will be two databases and several sequences that will be available for download below. Example of the database is the file small.txt: name,AGATC,AATG,TATC Alice,2,8,3 Bob,4,1,5 Charlie,3,2,5 Example of the sequence is the file 1.txt: AAGGTAAGTTTAGAATATAAAAGGTGAGTTAAATAGAATAGGTTAAAATTAAAGGAGATCAGATCAGATCAGATCTATCTATCTATCTATCTATCAGAAAAGAGTAAATAGTTAAAGAGTAAGATATTGAATTAATGGAAAATATTGTTGGGGAAAGGAGGGATAGAAGG Implement/modify the following functions: Modify the function readData, which will now take an additional parameter: a string representing the filename containing the database of individuals and their STR counts. It will also return a bool indicating if opening the file was successful or not: bool readData(string filename, vector<string>& nameSTRs, vector<string>& nameIndividuals, vector<vector<int>>& STRcounts) Update the function…
- C++ Inside the following function declaration, make a method that creates a child process. The child process should create a directory named ‘new’ using the ‘mkdir’ command, and the parent process should wait for it to finish and then use the ‘ls’ command to list the folder that contains the new directory. Your solution can be no more than 16 lines long. Namespaces, blank lines, and the declaration written do not count towards this limit. You can also assume that any necessary components are included through the '#include' operand.Part 1: In C#, Create a Class Called FileRoot As we know, when we run a program, the program runs from the bin folder. If I had a file stored at the root of the project and if the program is running, it wouldn't know where it is unless it came out of the bin folder. Before implementing the classes below, create a class that will help you get from the bin folder to the project's root. Hint: Directory class and its static methods would help here.Please help me with the assignment below The assignment: Make a telephone lookup program. Read a data set of 1,000 names and telephone numbers from a file that contains the numbers in random order. Handle lookups by name and also reverse lookups by phone number. Use a binary search for both lookups. This assignment needs a resource class and a driver class. The resource class and the driver class will be in two separate files. The driver class needs to have only 5 or 7 lines of code. The code needs to be written in Java. Please help me with exactly what I asked for help.
- THIS IS THE REFERNCE FOR COPY:Dictionarya) Define a function createUser() with an arbitrary dictionary parameter. This function returns a dictionary based upon input arguments.b) Define a function printUser() with a parameter user which is a dictionary. This function prints the contents of the dictionary user.c) Create and print the user: John, age 43, job Programmer, Hobby Bikingd) Create and print the user: Sara, age 20, school QCC, major CSIS ANSWER THIS QUESTION: Modulesa) 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.py: 1. Import all functions…modify task6.c to create a tool that remove those files from the current working directory. You can use strstr() function to search for .bak, or .old in entry->d_name. Modify this program to clean up .bak .old files.*/ #include <stdio.h>#include <dirent.h>#include <string.h>#include <errno.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <time.h> int main(int argc, char *argv[]){ if(argc!=1) return 1; char *path = "."; //current working directory DIR *dir = opendir(path); if(dir==NULL){ fprintf(stderr, "Cannot open dir %s: %s\n", path, strerror(errno)); return 1; } struct dirent *entry; while((entry=readdir(dir))!=NULL){ printf("%ld %s\n", entry->d_ino, entry->d_name); }using c++ In this assignment you are going to implement your own version of university library system,Thesystem will have two different sides , the first one is to help the librarian to do his job and the other side for admin to manage every one permissions in the system , so You should provide the following features in your system: Admin view o Add/remove Studentso Add/remove librarian o Add/remove other admins Librarian viewo Add/Delete bookso Issue/Return bookso View bookso View Issued bookso Log in /log outo Search for the book(id/name) Simple backend for your system , You could use a file each row should represent itemo Books File should be something like:Id , Book Name, Author Name, Available quantity, Issued Quantity1,Oliver Twist, Charles Dickens,98,2In the previous the first row was the name of each column , you can do that or handle it in your code , id =1 , Book Name =Oliver Twist ..Etc. Tables neededo Books Id Book Name Author Name Available quantity Issued…