4. A medical doctor has a database of his patients that includes the weight and height of each patient. This database is stored in a file called patients.txt. The example to the right shows how the patient's records are stored in the text file. Moosa 85.3 1.62 Badr 59.8 1.55 Saleem 75.0 1.73 Hind 52.1 1.65 In this text file, the first column shows the patient's name. The second and third columns show the weight (kilograms) and height (meters) of each patient, respectively. Note that any patient appears only once in the database file. The doctor would like you to help him to calculate the body-mass index (BMI) of a selected patient in the database. This will help the doctor to determine if the patient is overweight or not. The example below shows how BMI is calculated for a patient (user input's is in bold): Please enter the name of the patient: Badr BMI of the patient Badr = 24.8907 kg/m2.
Q: 4.4 Using a text editor or word processor, create a text file containing a series of five surnames…
A: Algorithm: 1. The scanner function will scan the input file. 2. Then hasNext function will add…
Q: For reading and for processing data of employee records stored in a file named employee.txt,the…
A: C Program: #include<stdio.h>#include<conio.h> int main(){ FILE *fp; char con,…
Q: choose the right answer : 1. Intermediate Stream operation ……………. Results in a stream in which…
A: We need to find the correct answer for the given 5 questions from the multiple choice options.
Q: What is the difference between static and extern storage class? Given suitable examples in support…
A: STATIC: The purpose of ‘static’ is to keep a local variable in existence during life-time of program…
Q: 4. Consider the following file access matrix:- File 2 File 4 File 1 File 3 Account I Account 2 Own…
A: Given:
Q: Example 3-1. DigestThread import java.io.*; import java.security.*; import javax.xml.bind.*; // for…
A: The text and the formatted image of the program are given below: import java.io.*; import…
Q: 3. Laramie Park District has files of participants in its summer and winter programs this year. Each…
A: The answer is given below:-
Q: In c++ creates a function checkWord that: 1) uses an input file stream to read input file (file1)…
A: SUMMARY: - Hence, we get the output.
Q: 3. Write a C++ program that prompts the user to enter a file name that contains the total mark of…
A: PROGRAM: //Header file #include<iostream> #include<string> #include<unordered_map>…
Q: Bella is a psychology student who is carrying out an experiment in which she repeatedly asks people…
A: #Create a function with file name as parameter def make_dictionary(fileName): #Open the file in…
Q: 7. Assuming that an operator overload for the stream extraction operator is created for class Planet…
A: 7. option c , cin>>Planet p; 8. True 9. option c, both a and b are correct
Q: Write a program in C++ to open and read the contents of th . ” of the current e Text1.txt using the…
A: code: #include <fstream>#include <iostream>using namespace std; int main () { string…
Q: Write a python program that reads the file’s contents and calculates the average number of words per…
A: 1. Open the file- "text.txt" 2. Declare and initialize 2 variables- cWords and cLines, with 0 3. For…
Q: Given main(), complete the Car class (in files Car.h and Car.cpp) with member functions to set and…
A: Car.h #ifndef CARH#define CARH class Car{private:int modelYear; int purchasePrice;int currentValue;…
Q: USING PYTHON Write a program that uses a dictionary to assign “codes” to each letter of the…
A: A required Python program is as follows, def encryption(codes): # Open file with normal message…
Q: Write a program that uses a dictionary to assign “codes” to each letter of the alphabet. For…
A: In this program we read content of file and replace with corresponding codes from dictionary.…
Q: A database for the telephone directory is maintained in the file "tele.txt" with the following…
A: Since no programming language is mentioned, I am using python. Code:…
Q: 2. Write a program in C++ to open and read the contents of the Text1.txt using the file stream…
A: Sample Response: //C++ program to open and read the contents of the Text1.txt file using the file…
Q: B’ : ‘@’, ‘b’ : ‘#’, etc . . .}Using this example, the letter A would be assigned the symbol %, the…
A: given - #program should be written in python with comments. Write a program that uses a dictionary…
Q: Write a C++ program that: • Creates a function checkWord that: a. uses an input file stream to read…
A:
Q: For example, suppose the word “robot" is found in lines 7, 18, 94, and 138. The dictionary would…
A: Since you did not specify a language, I wrote the code in python
Q: Part I Assume that a N x M matrix is stored in a file. However, the file is corrupted somehow, and…
A: Given:
Q: Write a program that expands on the program below (i.e. reading data of each record in the file and…
A: Programming instructions: Open the file with the filename in writing mode. Write the values of…
Q: Python. file in, two files out, sorting by key and value of a dictionary. Read from a file…
A: The program file for the given problem is given below: #dictionary to read the file and hold its…
Q: A C++ program that reads the records from a golf.txt file and displays them. Quick and dirty…
A: The code in java is given in step 2:
Q: Computer Science Written in C, if I have a global 2d array [256][10] and it is already filled with…
A: #include <stdio.h>// replacee below array to array[256][10]#define row 5#define col 10int…
Q: Consider the binary file named, "Course_Data" whose format is below. Each record represents a course…
A: Course_Data obj; int avg=0; for(int i=1;i<=obj.NOA;i++){ if(obj.LGrade=='A'){ avg+=obj.NGrade; }…
Q: Write a Python program that chooses the best 5 quiz scores from a file with student ID and scores.…
A: In this program we need to first open the file and then extract the student id and list of scores.…
Q: QUESTION 2 Pointers are never used for * pointing to an object pointing to a variable Oe pointing to…
A: 2. Option e (None of the above) Because pointer is used to point to variable, object, file and for…
Q: Consider the following code chunk: import random x = 0 while(x < 4): x = random.choice([1, 2, 3])…
A: Inside the while condition(x<4): x = random.choice([1, 2, 3]) x is always either 1 or 2 or 3 So…
Q: using c++: Write a class date (d, m, y), class file (name, size, creation_date) and class directory…
A: #include<iostream.h> #include<conio.h> class Date { public: int day,month,year;…
Q: Four weekend Programming classes consist of students with the following numbers: Class I=32…
A: Program Test1=[76 78 68 82]Test2=[58 65 70 66]Test3=[82 84 75 90]Test4=[77 68 69 75]…
Q: 2. Write a C program that process an unknown number of student information from student.txt which is…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Write a music market management system program in C++. Records in the library will be kept in 1 text…
A: ALGORITHM:- 1. Declare a data structure to store music details. 2. Define a function to take input…
Q: Homer has two companions Alice and Bob. The two of them are string fans. At some point, Alice…
A: Here have to determine about the Alice and Bob choose to play a game programming problem statement.
Q: Write a program to read the names stored in three different files: file1.txt, file2.txt and…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: sing good OOP, write a C++ program that will read an input file to manage a list of students waiting…
A: Given that, Write a C++ program that will read an input file to manage a list of students waiting to…
Q: Write a java program that will generate a permuterm index from the terms in the files in an input…
A: import java.io.*;import java.util.*; public class Permuterm { // defination for the…
Q: Scenario You are required to tally the results of a small football competition. Based on an input…
A:
Q: Problem 3: Complete this code: https://paste.ubuntu.com/p/kp25C3TSmG/ Description: Create a class…
A: The main objective of the program is to create three classes namely Course.java Student.java…
Q: 2. a. Write a class with name EmployeeInfo that will keep track of employees name, salary, post, and…
A: Here is the approach : Create the class with the attiributes . Read the file and create the…
Q: Consider a square region in the first quadrant of the Cartesian plane whose bottom left and upper…
A: Here is the program with the function:
Q: Example 12.7 Write a program that will receive a filename and a line of text as command line…
A:
Q: Write a C++ program for a company that owns several orchards, data is provided in a text file called…
A: The C++ program and necessary comments are provided in the program Input text file: Sample output…
Q: Write a program to process stock data. The stock data should be read from a text file containing the…
A: import java.io.BufferedReader;import java.io.FileReader;import java.io.InputStreamReader;import…
Step by step
Solved in 2 steps with 2 images
- PYTHONPLEASE ALSO SHARE CODE THROUGH LINK: online-python(dot)com Create a python program that reads the student information from a tab separated values (tsv) file. The python program then must creates a text file that will records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midtrm1 score, Midtrm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfoScore.tsv. Assume the number of students is at least 1 and at most 20. The program performs the following tasks: Read the file name of the tsv file from the user. Open the tsv file and read the student information. Compute the average exam score of each student. Assign a letter grade to each student based on the average exam score in the following scale: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 Compute the average of each exam. Output the last names, first names, exam scores, and letter…Two data files are required to evaluate a multiple-choice examination. The first file (booklet.dat) (memo) contains the correct answers. The total number of questions is 50. A sample file is given below: ACBAADDBCBDDAACDBACCABDCABCCBDDABCACABABABCBDBAABD The second file (answer.dat) contains the students’ answers. Each line has one student record that contains the following information: The student’s answers (a total of 50 answers): each answer can be A, B, C, D or * (to represent no answer). There are no blanks between answers. Student ID Student name A sample file is given below: AACCBDBC*DBCBDAAABDBCBDBAA*BCBDD*BABDBCDAABDCBDBDA 6555 MAHMUT CBBDBC*BDBDBDBABABABBBBBABBABBBBD*BBBCBBDBABBBDC** 6448 SINAN ACB*ADDBCBDDAACDBACCABDCABCCBDDABCACABABABCBDBAABD 6559 CAGIL Write a C++ program that counts the total number of correct answers by each student and outputs this information to another file called report.dat. In this file, the student’s IDs, names and the scores must be given. Each…PROGRAMMING 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.
- Suppose that the file inData.txt, data set 1, 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.00% Paycheck: $4116.00…write in c++Write a program that would allow the user to interact with a part of the IMDB movie database. Each movie has a unique ID, name, release date, and user rating. You're given a file containing this information (see movies.txt in "Additional files" section). The first 4 rows of this file correspond to the first movie, then after an empty line 4 rows contain information about the second movie and so forth. Format of these fields: ID is an integer Name is a string that can contain spaces Release date is a string in yyyy/mm/dd format Rating is a fractional number The number of movies is not provided and does not need to be computed. But the file can't contain more than 100 movies. Then, it should offer the user a menu with the following options: Display movies sorted by id Display movies sorted by release date, then rating Lookup a release date given a name Lookup a movie by id Quit the Program The program should perform the selected operation and then re-display the menu. For…Print Person Information from file In this lab you are asked to complete the function : print_person_from_file(person_name, filename). This function should read in data from the file filename and print the information for person_name if it is found in the file. The file filename contains lines, in comma separated format (with a 'csv' extension) For each line, the items in each field are as follows: Field 1 3 4 Name Place of Birth Date of Birth Children For Children: • a person can have 0, 1 or multiple Children Multiple children are semi-colon separated If a person has no children the field contains 'NA' For example, consider the following lines froma .csv file, where Fletcher_Margaret has 3 children, and Baker_Jill has 0 children (field 4 contains the string 'NA') Fletcher Margaret,Sydney,30-09-1921,Green Bob;Green Nancy;William Tom Baker_Jill, Melbourne,08-09-1973, NA Format for Printing If the person_name is found in the file, the format for printing the person information is as…
- IN C++ Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Hints: Use the find() function to find the index of a comma in each…A file has r=20000 STUDENT records of fixed-length. Each record has the following fields: NAME (30 bytes), SSN (10 bytes), ADDRESS (40 bytes), PHONE (9 bytes), BIRTHDATE (8 bytes), SEX (1 byte), MAJORDEPTCODE (4 bytes), MINORDEPTCODE (4 bytes), CLASSCODE (4 bytes, integer), and DEGREEPROGRAM (3 bytes). Suppose the block size is 512 bytes. (a) Calculate the record size R in bytes. (b) Calculate the blocking factor (number of tuples per block) and the number of blocks required. (c) Calculate the average block accesses it takes to find a record by doing a linear search on the file. (d) Assume the file is ordered by SSN; calculate the block accesses takes to search for a record given its SSN value by doing a binary search.DescriptionWrite a program to compute average grades for a course. The course records are in a single file and are organized according to the following format: each line contains a student's first name, then one space, then the student's last name, then one space, then some number of quiz scores that, if they exist, are separated by one space. Each student will have zero to ten scores, and each score is an integer not greater than 100. Your program will read data from this file and write its output to a second file. The date in the output file will be nearly the same as the data in the input file except that you will print the names as last-name, first-name; each quiz score, and there will be one additional number at the end of each line:the average of the student's ten quiz scores.Both files are parameters. You can access the name of the input file with argv[1]. and the name of the output file with argv[2].The output file must be formatted as described below: 1. First and last names…
- A temperature file consists of five records, each containing a temperature in degrees Fahrenheit. A program is to be written that will read the input temperature, convert it from degrees Fahrenheit to degrees Celsius and print both temperatures in two columns on a report. Column headings, which read ‘Degrees F’ and ‘Degrees C’, are to be printed at the top of the page. What ist he best solution algorithm to successfully implement the above question?A file has r = 20, 000 STUDENT records of fixed length. Each record has the following fields: NAME (30 bytes), SSN (9 bytes), ADRESS(40 bytes), PHONE(9 bytes), BIRTHDATE (8 bytes), SEX(1 byte), CLASSCODE( 4 bytes, integer) MAJORDEPTCODE(4 bytes), MINORDEPTCODE(4 bytes), and DEGREEPROGRAM( 3 bytes). An additional byte is used as a deletion marker. Block size B = 512 bytes. a) Calculate the blocking factor bfr (=floor(B/R), where R is the record size) and number of file blocks b, assuming unspanned organization (a record can’t be split across blocks). b) Suppose only 80% of the STUDENT records have a value for PHONE, 85% for MAJORDEPTCODE, 15% for MINORDEPTCODE, and 90% for DEGREEPROGRAM. We use a variable-length record file. Each record has a 1-byte field type for each field in the record, plus the 1-byte deletion marker and a 1-byte end-of-record marker. Suppose that we use a spanned record organization, where each block has a 5-byte pointer to the next block (this space is not used…Write C program language Department of computer science offers a set of courses each semester. These courses are listed in a file as follows: course name, course id, number of registered student, and max number of students. Number of registered students is initialized to zero always. The file that contains the courses’ information is formatted as follows (i.e. sample course file): Each semester, students are required to register a set of courses. The students are listed in a file along with the courses to be registered as follows: student name, student id, courses to be registered (COMP242, COMP336, COMP231...). The file that contains the students’ information is formatted as follows (i.e. sample student file): Course File Java#COMP231#0#27 Data Structures #COMP2321#0#30 Algorithms#COMP336#0#15 Computer and Programming#COMP142#0#27 Student File Ahmad Ali#1159999#COMP242#COMP336#COMP231#COMP338 Ali Mahmoud#1169999#COMP142#COMP336#COMP231 Ashraf Hasan…