Given an input file (numbers.txt) that contains one integer on each line. Read all the numbers and determine the largest and smallest numbers in the file. Output these numbers to the output file (largeAndSmall.txt). Code is added to the end to allow your solution to be auto-graded. C++
Q: LAB Q - Write a program in c to read names from the file "name.txt", which include (10) names ,then…
A: to use string function string.h header file is include strlen() is use to calculate length of…
Q: What will be the content of 'file.c' after executing the following program? #include int main() {…
A: This is the minified version of the code written. So the code written in a correct way is as under:…
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: Exercise 1. (Spell Checker) Write a program spell_checker.py that accepts words from standard input;…
A: The objective is to write a program (spell_checker.py) that accepts words from standard input; looks…
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: Assume that there are two given files - students1.txt and students2.txt that store sorted first…
A: The C programming languages are used to create the web applications and are used for the other…
Q: 5.13) A baseball player's batting average is calculated as the number of hits divided by the…
A: the answer is given below:-
Q: Python 3.7.4 Store four file objects corresponding to the files winter2003.txt , spring2003.txt,…
A: Python statements for creating file objects: winter=open("winter2003.txt",…
Q: Solve by Sava **12.27 (Replace words) Suppose you have a lot of files in a directory that contain…
A: /** * * (Replace words) * Suppose you have a lot of files in a directory that contain…
Q: Create a new file in c++ and save it as lab11_XYZ.cpp (replace XYZ with your initials). Create…
A: Program Instructions:In the header file, create a temporary variable temp of the data type of each…
Q: 3. Write a program that prompts the user for a file name, assuming that the file contains a Java…
A: Program Algorithm: 1. File import creates new file 2. Inside the try loop the scanner reads the…
Q: Edit the following code to read the input for 10 students from a file testData1.txt and output the…
A: In this problem, you need to edit given code, you need to use loop in it. In given code, to read 3…
Q: ** 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: GIVEN:
Q: 29. Write an application that removes extra spaces from a text file. In the days of the typewriter,…
A: Ans 29. The following are the identified program tasks from the given application: Step 1: Get an…
Q: 13. The reciprocal Fibonacci constant y is defined by the infinite sum: ν- ΣΕ where F, are the…
A: Program:n = [10 50 100];for j = 1:3a = 1;b = 1;reci = 1/a+1/b;for i = 1:n(j) - 2c = a + b;reci =…
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: Mass Write a C++ program that computes density of an object using formula, Volume Create a text file…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: 3. Write a program that prompts the user for a file name, assuming that the file contains a Java…
A: Algorithm: 1. Read the file using file import . 2. The try loop will continuously evaluate the file…
Q: 10.9 (Using Unions) Create union floatingPoint with members float f, double d and long double x.…
A: The program is written in c
Q: try: f-open("demofile.txt", "r" ) f.write("Lorum Ipsum") except: print("Something went wrong when…
A: Here the given file demofile.txt cannot be opened and is not writable. It is read only file. Hence…
Q: HW5: Write a function to count number of words in a text file named "story.txt".
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: ** 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: Programming approach Importing the required packages in the program. Obtain the file path as…
Q: A photographer is organizing a photo collection about the national parks in the US and would like to…
A: Ans:) NOTE: I am solving this problem in python as no programming language is mentioned. Approach:…
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: 8) Write a program that finds pairs of numbers between 1 and 49 that have no common divisor other…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write C++ code to read a list of integers from a file until the end of the file is reached. When the…
A: Required: Write C++ code to read a list of integers from a file until the end of the file is…
Q: 4.51 Generate an index for a book. The input file consists of a set of index entries. Each line…
A: Step 1: Declare the class LLSubIndex with data members entryName, startPNum, endPNum and next…
Q: **12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: import java.util.*;import java.io.*; public class Exercise { /** Main method */ public static void…
Q: using chapters 1 to 10 from the book C how to program edition 8
A: #include <stdio.h>union integer{ char c; short s; long b; int i;};int main(void){…
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: Create a flex file which recognizes if a given string is a word or a number. (Hint: Not like the…
A: Flex file which recognize if given string is a word or a number
Q: ** 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: Programming approach Importing the required packages in the program. Obtain the file path as…
Q: (Python Please) (Count consonants and vowels) Write a program that prompts the user to enter a text…
A: Here I take test file as a input. In which i have written one line which is : Hello , this is a test…
Q: Write a program that will create file with at least 10 lines. Each line of your file should have…
A: Write a program that will create file with at least 10 lines. Each line of your file should have…
Q: 5) Practice: Write a program that randomly generates the ages of 100 people between the values of 0…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
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: (Replace words) Suppose you have a lot of files in a directory that contain words Exercisei j.,…
A: Code:- import java.util.*;import java.io.*; public class Exercise_12_27 { /** Main method */ public…
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: 21.7 LAB: Login name (Use python) Write a program that creates a login name for a user, given the…
A: name = input("Input: ") lst = name.split(" ") #lst[0] = first name, lst[1] = last name, lst[2] =…
Q: **12.27 (Replace words) Suppose you have a lot of files in a directory that contain words…
A: It is defined as the programs can be asked from control statements, array, string, oops etc. Java…
Q: Using a sound level meter, the noise emanated from 10 Proton X50 at different frequency levels are…
A: a) Program: #include <iostream>#include <fstream>using namespace std; int…
Q: Python 3.7.4 Given four files named asiasales2009.txt, europesales2009.txt, africasales2009.txt, and…
A: Statements for creating objects:#for first file asiasales2009.txt for writingasia =…
Q: *12.13 (Count characters, words, and lines in a file) Write a program that will count the number of…
A: Program to calculate no. Of lines, words and character in a file is given below
Q: 13. The reciprocal Fibonacci constant y is defined by the infinite sum: Σ. where F, are the…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: 4.26 The cryptography function crypto() takes as input a string (i.e., the name of a file in the…
A: The cryptography function crypto() takes as input a string.The function should print the file on the…
Q: 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories…
A: Here is the solution of the above program:
Q: n C++, add movies and prices to an existing text file using STL iterators, containers , or…
A: ALGORITHM:- 1. Open the file in the append mode. 2. Take choice from the user for adding the movie…
10.12 Lab Two - Chapter Ten
Given an input file (numbers.txt) that contains one integer on each line. Read all the numbers and determine the largest and smallest numbers in the file. Output these numbers to the output file (largeAndSmall.txt). Code is added to the end to allow your solution to be auto-graded.
C++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Create an input text file that has the name input.txt with the following content. In Java please. 10 45 23 14 76 55 14 34 11 4 1212. What is the output of the following program? (2, 3, 6, 8) #include #include #include #include using namespace std; int main() { double x, y; string str; x = 9.0; y = 3.2; cout (sqrt(pow (y, 4))) = " (sqrt(pow (y, 4))) << endl; str = "Predefined functions simplify programming code!"; cout << "Length of str = " << str.length() << endl; return 0; }10-8. Cats and Dogs: Make two files, cats.txt and dogs.txt. Store at least three names of cats in the first file and three names of dogs in the second file. Write a program that tries to read these files and print the contents of the file to the screen. Wrap your code in a try-except block to catch the FileNotFound error, and print a friendly message if a file is missing. Temporarily rename each of your files, and make sure the code in the except block executes properly. Make sure an exception is caught for either file missing.
- #1 A) Write a program to print all alphabets from A to Z. You will be using the JSR putchar command. B) Write a program to print the hexadecimal equivalents of all alphabets from A to Z. You will be using the JSR out2hex command in the previous question instead of JSR putchar.Python 3.7.4 Store four file objects corresponding to the files winter2003.txt , spring2003.txt, summer2003.txt, and fall2003.txt in the variables winter, spring, summer, and fall (respectively), and open them all for reading.Please use python not java or C++ A straight line can be defined by a pair of points p1(x1, y1) and p2(x2, y2). The slope m of a line is defined as follow: ? = ?% − ?' ?% − ?' Your program reads the points from a text file called ‘points.txt’ which contains the coordinates of unknown number of pairs of points as shown in Figure 1. Each line contains four values x1, y1, x2, y2, where x1, y1 are the coordinates of the first point and x2, y2 are the coordinates of the second point. Figure 1. Input file contains unknown number of point pairs Use Spider, to create the following files: (i) The input file ‘points.txt’ shown in Figure 1. (ii) Your Python program that reads from the input file ‘points.txt’, the coordinates of unknown number of pairs of points, computes the corresponding slopes then prints the results on the screen as shown in Figure 2. Figure 2. The output on screen Your program must define and use the following functions: 1. printHeader(...): prints on screen the three lines…
- 3. Suppose you have a text file called notes.txt. You are provided with this notes.txt file on the blackboard. Write a C++ code to display the word that appears most in the notes.txt file and how many times the word appears. This is called word frequency. Your code should automatically find this word that appears most in the text file and also should automatically calculate how many times this word appears. Your code should be such that when I use it to count words from a file with million words, it should tell me which word appears most, this means I do not need to look at the file to know the word first. Your code should also count the number of characters in the word you found and also convert the word to all CAPS. Your code should also count the total number of words in the file. For example, suppose a text file has the following text: Apple Mango Apple Apple • Your code will be recompiled during marking to see if it gives the output you found. • You are to complete this…Exercise 1:Write a Python program that reads from the user the name of two files (an input file and an outputfile). The program will then read each line of the input file and save it in the output file preceded with the line number and removing any of the following punctuations (. , ! ? ; :) found at the end of the line. For example, if the input file is: Mary had a little lamb;Whose fleece was white as snow;And everywhere that Mary went;The lamb was sure to go! Then the output file the content of the input file and saves it in the produced output file will be Line 1: Mary had a little lambLine 2: Whose fleece was white as snowLine 3: And everywhere that MaryLine 4: The lamb was sure to gotask 14.1 in java Follow these steps:● Create a new java file called MyFile.java● Write code to read the content of the text file input.txt. For each line ininput.txt, write a new line in the new text file output.txt that computesthe answer to some operation on a list of numbers.● If the input.txt has the following:Min: 1,2,3,5,6Max: 1,2,3,5,6Avg: 1,2,3,5,6Your program should generate output.txt as follows:The min [1, 2, 3, 5, 6] is 1.The max of [1, 2, 3, 5, 6] is 6.The avg of [1, 2, 3, 5, 6] is 3.4.● Assume that the only operations given in the input file are min, max andavg and that a list of comma-separated integers always follows theoperation. You should define the functions min, max and avg that take ina list of integers and return the min, max or avg of the list.● Your program should handle any combination of operations and anylength of input numbers. You can assume that the list of input numbersare always valid integers and that the list is never empty.● Compile, save and run…
- ● Create a Python file called amazon.py in this folder.● Write code to read the content of the text file input.txt.● For each line in input.txt, write a new line in the new text file output.txtthat computes the answer to some operation on a list of numbers.● If the input.txt has the following:o Min: 1,2,3,5,6o Max: 1,2,3,5,6o Avg: 1,2,3,5,6● Your program should generate output.txt as follows:o The min of [1, 2, 3, 5, 6] is 1.o The max of [1, 2, 3, 5, 6] is 6.o The avg of [1, 2, 3, 5, 6] is 3.4.● Assume that the only operations given in the input file are min, max andavg, and that the operation is always followed by a list ofcomma-separated integers.● You should define the functions min, max and avg that take in a list ofintegers and return the min, max or avg of the list.● Your program should handle any combination of operations and anylength of input numbers.● You can assume that the list of input numbers are always valid integersand that the list is never empty.● Hint: there is…Follow these steps:● Create a Python file called amazon.py in this folder.● Write code to read the content of the text file input.txt.● For each line in input.txt, write a new line in the new text file output.txtthat computes the answer to some operation on a list of numbers.● If the input.txt has the following:o Min: 1,2,3,5,6o Max: 1,2,3,5,6o Avg: 1,2,3,5,6● Your program should generate output.txt as follows:o The min of [1, 2, 3, 5, 6] is 1.o The max of [1, 2, 3, 5, 6] is 6.o The avg of [1, 2, 3, 5, 6] is 34Exercise 2:Write a Java program that allows the user to specify a file name on the command line and prints the number of characters, words, lines, average number of words per line, and average number of characters per word in that file. If the user does not specify any file name, then prompt the user for the name.