Suppose that you have a text file (temperature.txt) that contains registered temperatures for a given period of time. You don't know how many values are stored in the file. Write a complete program that reads these temperatures from the file and print out the following: The number of temperatures stored in the file. The maximum temperature. The minimum temperature. The average temperature. Note: You are not allowed to use the function concept, as we did not see it yet.
Q: Question: Write a program that reads a series of dates in day/month format, from the file…
A: Given:
Q: Write a program in python for a (very) rudimentary shooter "game". You are the only shooter and you…
A: Source Code# import the required modulesimport randomimport time#Definition of the function…
Q: Write a program that includes a function that calculates the equation F= x" sin x. Write the values…
A:
Q: Write a function that reads a single line of numbers from a file named "question1.txt", and returns…
A: Algorithm: Step1: Open the text file in read write mode. Step2: Read the line with numbers and split…
Q: You will write a program that will calculate the area of a square based on a randomly generated…
A: I give the code along with output and code screenshot in Python
Q: You are required to write a C++ program that reads several hundreds of movie ratings from an input…
A: A C++ program is as follows, File name: “main.cpp” //Header file #include <iostream> #include…
Q: Write a program in Python for a (very) rudimentary shooter "game". You are the only shooter and you…
A: NOTE: Sample output is missing in the question. The following program is executed for own sample…
Q: write a program that computes and prints the average of the numbers in a text file. you should make…
A: in step 2, I have provided TXT FILE SCREENSHOT--- in step 3, I have provided PYTHON CODE---…
Q: You are required to write a C++ program that reads several hundreds of movie ratings from an input…
A: Program: //Header file #include <iostream> #include <vector> #include <fstream>…
Q: Muscat marketing research company is conducting a rating survey of different chains of supermarkets.…
A: Program Plan: Read the files as stream. read the file line by line and push the values into the…
Q: Muscat marketing research company is conducting a rating survey of different chains of supermarkets.…
A: the code is an given below :
Q: You are required to write a C++ program that reads several hundreds of movie ratings from an input…
A: PROGRAM: //Header file #include <iostream> #include <vector> #include <fstream>…
Q: In Python Define a function writeScores with two parameters. The first should be the name of a file,…
A: Following is the python program which defines a function writeScores having two parameters file and…
Q: Write a c++ program v.cc that allows to read from a file vot.in the last names of the candidates in…
A: the code of the given program is given below:-
Q: Problem A straight line can be defined by a pair of points pi(xX1, y1) and p2(x2, y2). The slope m…
A: from os import path from math import inf def printHeader():…
Q: Write a program that includes a function that will find how many times an animal has been sighted.…
A:
Q: Write a Python program that calculates the average 5 quiz scores from a file with student ID and…
A: Note: Both txt files and .py files should be saved in Desktop. i consider only 5 quizes but the…
Q: Write a program whose input is two integers and whose output is the two integers swapped. Ex: If…
A: """Program to take input numbers from user and display swapped value using function""" #function to…
Q: Your program should use a loop to read data from a text file which contains students' names and 3…
A: def main(): #set count of grades readFile() #readFile reads text file scores.txt and print the…
Q: or this task you are asked to write a program that will open a file called “story.txt” and count the…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: Write code for the following: Write Python code that uses a loop to prompt the user for five…
A: Write Python code that uses a loop to prompt the user for five floating point numbers and reports…
Q: You are required to write a C++ program that reads several hundreds of movie ratings from an input…
A: Program code: //Header file #include <iostream> #include <vector> #include…
Q: Write a program that reads a text and outputs the letters, together with their counts, as explained…
A: The program should have the following functions: Function main – calls all the functions. Function…
Q: You are given a file consisting of students' names in the following form: lastName , firstName…
A: A C++ program is as follows, File name: “main.cpp” //Header files #include<iostream>…
Q: Write a program to calculate the net pay of an employee, Input the basic pay, pass basic pay to user…
A: Objective: A program is built to insert the information about employees and calculate the net pay by…
Q: You are given a file consisting of students’ names in the following form: lastName, firstName…
A: stud.cpp #include<iostream>#include<fstream>#include<string>using namespace std;…
Q: Write a Python program that calculates the average 5 quiz scores from a file with student ID and…
A: Note: Both txt files and .py files should be saved in Desktop. i consider only 5 quizes but the…
Q: Write a python program, that takes three strings as input parameters. The function reads all the…
A: The code in python is given below with an sample output.
Q: Problem A straight line can be defined by a pair of points p.(x1, yı) and p2(x2, yz). The slope m of…
A: PROGRAM CODE: from math import infimport sys def printHeader():…
Q: Write a program that reads a text and outputs the letters, together with their counts, as explained…
A: Program code: #include <iostream> #include <fstream> using namespace std; // Create a…
Q: Write a function find_lowers() that takes a file name as a parameter, reads that text file, and…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read file name…
Q: Please answer it in Python Below are the first 4 lines of such a file whose number of lines is not…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: IN PYTHON PLEASE Write a function named translate that receives a day of the week ("Monday",…
A: Below is the required Python program: - Approach: - Define the function that takes two lists of…
Q: SO 1. Count total digits in the number SO 2, Count & Print the even digits SO 3. Count & Print…
A: SQ 1 #include <bits/stdc++.h> using namespace std; int findDigits(int n) { if (n == 1)…
Q: create functions to find the average number of stolen animals and another to get a list of unique…
A: Ans:) Program requirements: create a function average_stolen which gets a list of numbers and…
Q: Write a program that reads a text and outputs the letters, together with their counts, as explained…
A: Program code: #include <iostream> #include <fstream> using namespace std; // Create a…
Q: Muscat marketing research company is conducting a rating survey of different chains of supermarkets.…
A: #include<iostream> #include<conio.h> #include<fstream> #include<string>…
Q: Write a program that reads a text and outputs the letters, together with their counts, as explained…
A: A C++ program for the given criteria is as follows, #include <iostream> #include…
Q: Write a program which has a class named FileHandler to read StudentName, MarksObtained from the…
A: Note: As you have not specified any language, I have written a program in JAVA.
Q: python Write a function that reads in a text file, and counts the number of times each word occursin…
A: The program first creates a file sample.txt and stores a string in it. Then it reads the created…
Q: Write a program that includes a function that calculates the equation F= x" sin x. Write the values…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Initialize a list…
Q: Write a program that includes a function that calculates the equation F= x" sin x. Write the values…
A: The solution for the above given question is given below:
Q: Suppose you wanted to read a very large file of text. Which of the following functions would you…
A: Given functions are void readFile1(int f){ char c; while (read(f, &c, 1)==1){…
Q: another such that ratio of the radius of adjacent discs remains constant. The area is a cone is…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: Write a function (in a file called convert_knots.cpp) that converts knots into miles per minute. The…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: Muscat marketing research company is conducting a rating survey of different chains of supermarketS.…
A: In this question we have to perform the following task using file handling in C++. What and when to…
Q: For an e-Shop, there is a Customer whose data is stored in a file ‘Customers.txt’, where ID, Name,…
A: Program approach:- Function to pay. Accessing each row. Checking for required customer-id. Checking…
Q: Your function must find the oldest pet of a given breed (3rd input parameter) from the inFile and…
A: 1. function max age : parameter infile outfile breed a. open both file in try block b.…
Q: Write a function charHistogram(filename: str) -> None that takes the file name of a text file and…
A: It is defined as a frequency distribution shows how often each different value in a set of data…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- (5) Write a function called copy_even_lines() that takes two strings (filenames) as input parameters and copies every other line from the first file into the second. That is, counting from 0, it copies the 0th line, the 2nd line, the 4th line, etc. from the first file to the second file. You may assume that both files exist. (6) Write a python program that asks the user for two filenames and calls your function copy_even_lines() from (5) using those two filenames. If one or more files do not exist, your program must handle the exception by repeating the prompts until valid filenames are entered.Write a program that reads a text and outputs the letters, together with their counts, as explainedbelow in the function printResults. Your program should not have any global variables. Allinformation should be accessed through the parameters of the functions. Your program shouldhave the at least the following functions:• Function main – calls all the functions• Function openFile – opens the input and ouput files. This program has the file streamdeclare a refence parameter. An appropriate error message should be displayed if the filedoes not exist. The program must ask the user for the names of the input and output files.• Function countLetters – counts every of uppercase letters A – Z and lower-case lettersfrom a – z in the text file opened in the function openFile. This information should be storedin an array of structures. Both the array and file identifiers must be passed as parameters.• Function printResults – prints the number of uppercase letters for every occurrence of A–Zand…Implement a function wordCount, which reads a text file, and returns thenumber of words in the file. You can assume the file only contains thealphabet characters and the space character. However there may be morethan one space character between two words, so “abc abc” and “abc abc”,for example, are both two words. int wordCount ( const char * filename ) {}
- Write a program that reads a text and outputs the letters, together with their counts, as explainedbelow in the function printResults. Your program should not have any global variables. Allinformation should be accessed through the parameters of the functions. Your program should:have the at least the following functions:• Function main – calls all the functions• Function openFile – opens the input and ouput files. This program has the file streamdeclare a refence parameter. An appropriate error message should be displayed if the filedoes not exist. The program must ask the user for the names of the input and output files.• Function countLetters – counts every of uppercase letters A – Z and lower-case lettersfrom a – z in the text file opened in the function openFile. This information should be storedin an array of structures. Both the array and file identifiers must be passed as parameters.• Function printResults – prints the number of uppercase letters for every occurrence of A–Zand…Please answer it in Python Below are the first 4 lines of such a file whose number of lines is not known a priori: Bella 91.0 18.5 19.5 19.5 19.0 19.5 (91 is a dist note) Azhar 83.0 19.0 18.5 18.5 18.5 19.0 Clara 91.0 17.5 17.5 17.5 18.5 19.0 Dalton 92.5 17.0 18.5 18.5 17.5 18.0 Write a function import_result that takes as an argument the name of the file that contains the results file_name and reads it to make the list of results. Each item in this result list is a dictionary corresponding to a competitor. The keys to this dictionary are: • 'name' with the competitor's name associated • 'note_dist' with which is associated the score obtained by the competitor for the length of his jump. It is known from the question. • 'notes_style' to which is associated the list of 5 marks obtained by the competitor for the style of his jump. Thus, if the file passed as an argument consists only of the 4 lines given as an example previously, the function will return: [{'name': 'Bella',…Write a Python program that reads from a file, scores.txt, a list of test scores. Each line in the file contains one score. The program should calculate the average of all the scores, print to screen. The program should also have a function, num_passing, that takes as a parameter the list of grades and returns the number of scores that are above 64For example if scores.txt contained the following: 72 80 98 76 64 34 90 85 55 printed to screen should be: the average is 72 6 scores above 64
- For an e-Shop, there is a Customer whose data is stored in a file ‘Customers.txt’, where ID, Name, Phone, Address, Email and AmountBalance. When the customer buys a product and pays from his AmountBalance, the system checks his balance and deducts if enough amount is there. Otherwise the customer receives a message “You don’t have sufficient Balance in your wallet”. Write python code to create a ‘Customers.txt’ file with at least one customer’s record. Write a function pay(), that takes amount as an input, reads the file and gets AmountBalance, print “Successful Transaction” when payment can be made or a message “You don’t have sufficient Balance in your wallet”. Write a function checkBalance(), that reads the file and gets AmountBalance, prints “Amaount Balance” Write a function recharge(), that takes “Enter Amount you want to recharge”, reads the file and gets AmountBalance, adds the new amount in AmountBalance, update the file and prints “Success”You are given a file consisting of students’ names in the following form: lastName, firstName middleName. (Note that a student may not have a middle name.) Write a program that converts each name to the following form: firstName middleName lastName. Your program must read each student’s entire name in a variable and must consist of a function that takes as input a string, consists of a student’s name, and returns the string consisting of the altered name. Use the string function find to find the index of ,; the function length to find the length of the string; and the function substr to extract the firstName, middleName, and lastName.Write a program that reads a text and outputs the letters, together with their counts, as explained below in the function printResults. Your program should not have any global variables. All information should be accessed through the parameters of the functions. Your program should have the at least the following functions: • Function main – calls all the functions • Function openFile – opens the input and ouput files. This program has the file stream declare a refence parameter. An appropriate error message should be displayed if the file does not exist. The program must ask the user for the names of the input and output files. • Function countLetters – counts every of uppercase letters A – Z and lower-case letters from a – z in the text file opened in the function openFile. This information should be stored in an array of structures. Both the array and file identifiers must be passed as parameters. • Function printResults – prints the number of uppercase letters for every occurrence…
- Write a program that reads a text and outputs the letters, together with their counts, as explained below in the function printResults. Your program should not have any global variables. All information should be accessed through the parameters of the functions. Your program should have the at least the following functions: • Function main – calls all the functions • Function openFile – opens the input and ouput files. This program has the file stream declare a refence parameter. An appropriate error message should be displayed if the file does not exist. The program must ask the user for the names of the input and output files. • Function countLetters – counts every of uppercase letters A – Z and lower-case letters from a – z in the text file opened in the function openFile. This information should be stored in an array of structures. Both the array and file identifiers must be passed as parameters. • Function printResults – prints the number of uppercase letters for every occurrence…Write a function called max_age(inFile, outFile, breed) for a (python program), that takes three strings as input parameters. The function reads all the data from the inFile (1st input parameter) and writes data to the outFile (2nd input parameter) as described below. Each line in the input file represents a pet record and has the following format. name, breed, age where name and breed are strings, and age is an integer value. Your function must find the oldest pet of a given breed (3rd input parameter) from the inFile and write the following information to the outFile. breed, total records of this breed name of the oldest pet, age of the oldest pet Note that outFile must only have these two lines of information. Suppose, inFile contains the following data: shadow, longhair, 3 poshi, bangal, 5 mikus, longhair, 4 tigger, calico, 9 If you call this function with breed = "longhair", then the following must be written in the outFile: longhair, 2 mikus, 4 Your…You are given a file consisting of students’ names in the following form: lastName, firstName, middleName. (Note that some students may not have middle names). Write a program that converts each name to the following form: firstName middleName lastName. Your program must read each student’s entire name in a variable and must consist of a function that takes input as a string, consists of student’s name, and returns the string consisting of the altered name. Use the string function find to find the index of the function length to find the length of the string; and function substr to extract the firstName, middleName, and lastName. Test your program with a file consisting of the following names: Miller, Jason Brian Blair, Lisa Maria Gupta, Anil Kumar Arora, Sumit Sahil Saleh, Rhonda Beth