17197169104233430701740026705814
.jpg
keyboard_arrow_up
School
Sinclair Community College *
*We aren’t endorsed by this school
Course
1111
Subject
Computer Science
Date
Jul 1, 2024
Type
jpg
Pages
1
Uploaded by CountAntelopePerson4235
AN | @& Ask Copilot ol e L 1| of2 | o T CIS 1111 Files Assignment (20 Points) )escription: For this assignment, you will be provided a pre-populated file. You will need to search through the entire file for keywords entered from the keyboard. While we have provided the keywords to you, your program must still | collect them from the user. After searching the file, generate a new text file with a report that shows the total number of times each keyword was found. Your text file report should look i like the screenshot. The output will vary depending on which words NEHIT 3 File Edit Format View Help fThe keyword "it" was found 145 times. The keyword "the" was found 361 times. | you search for. Requirements: B ? 1. Output must be labelled and easy to read as shown in the sample output below. » 3 2. You must display how many times each keyword was found. % 3. Program must be documented with the following: R a. // Name b. // Date c. // Program Name d. // Description 4. Flowchart the logic of the program Sample Output: i What is the first keyword to search for? it 3
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
*Code in Python
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies.
Below is an example file along with the program input and output:
example.txt
I AM SAM I AM SAM SAM I AM
Enter the input file name: example.txt AM 3 I 3 SAM 3
The program should handle input files of varying length (lines).
arrow_forward
What does the following python code do?
f = open("sample.txt", "w")
Choose all that apply.
Select 2 correct answer(s)
Question 11 options:
If the file called sample.txt exists, it writes at the bottom of the file
if the file sample.txt exists, deletes everything in it
reads the file called sample.txt starting from the top
if the file sample.txt does not exist, it creates the file and opens it for writing
opens a file called sample.txt for appending
writes "w" to the file called sample.txt
opens a file called sample.txt for reading
closes a file called sample.txt
arrow_forward
Searching - a user should be able to search by ID or by item name
create only one menu item for searching
a user should be able to enter the name of the item using any case, (for example, sTRolleR)
you may wish to store items in all lower/upper case to expedite the search
write one search function that can search by ID and name and goes through the array of structs/objects only once
show the entire record if found or an appropriate message if not
Sorting - sort by any field
write one function to sort by any field using a parallel array of pointers
use Bubble Sort is not the most effective but the easiest to modify.
do not copy and paste sort code five times into the same function.
sorting using pointers is faster because you have to swap pointers only, which are normally stored in 4 bytes each; it also allows you to preserve the original order of the items
If you choose to have a submenu, a submenu must have an option to go back to the previous menu or main menu
if a user got…
arrow_forward
Finish this program from the code posted below! Note: There should be two files Main.py and Contact.py
You will implement the edit_contact function. In the function, do the following:
Ask the user to enter the name of the contact they want to edit.
If the contact exists, in a loop, give them the following choices
Remove one of the phone numbers from that Contact.
Add a phone number to that Contact.
Change that Contact's email address.
Change that Contact's name (if they do this, you will have to remove the key/value pair from the dictionary and re-add it, since the key is the contact’s name. Use the dictionary's pop method for this!)
Stop editing the Contact
Once the user is finished making changes to the Contact, the function should return.
Code:from Contact import Contactimport pickledef load_contacts():""" Unpickle the data on mydata.dat and save it to a dictionaryReturn an empty dictionary if the file doesn't exist """try:with open("mydata.dat", 'rb') as file:return…
arrow_forward
Problem: Write a Python program that
reads from an input file named employees.txt
some employee information and produces a salaries report on
screen.
The input file
employees.txt has a number of data lines. Each data line in the input file contains
information about one employee including: first name, last name, job code (an integer
between 1 and 4), and the number of days worked. The following is an example of what
the input file employees.txt can contain:
Ali Al-Harthi
22
Laila Al-Busaidi
4
25
Salim Al-Hajri
Badria Al-Sinani
2
21s
19
Abir Al-Hinai
1
15
Your program should produce a salaries report on screen using the format shown below.
Enter input file name: employee.txt
Name
Job Code
Days Worked
Salary (OMR)
Ali Al-Harthi
3
22
660.000
Laila Al-Busaidi
4
25
637.500
Abir Al-Hinai
15
600.000
Number of faulty records = 2
Number of valid records = 3
Average salary
= 632.500
The salary of each employee is equal to the number of days worked multiplied by the
daily pay rate. The daily pay…
arrow_forward
.
arrow_forward
please code in pythonredact_file: This function takes a string filename. It writes a new file that has the same contentsas the argument, except that all of the phone numbers are redacted. Assume that the filename has onlyone period in it. The new filename is the same as the original with '_redacted' added before theperiod. For instance, if the input filename were 'myfile.txt', the output filename would be'myfile_redacted.txt'. Make sure you close your output file.The first hard task in this function is to make the output filename from the input filename that waspassed in. You can break it into two pieces by splitting on the dot or by using the index method andslicing. Then put it back together again using string concatenation.We are also working with files in this one. To open a file with a filename stored in the variable fname,in read mode use the open function as such: fp = open(fname). You will need to open the outputfile in write mode: open(fname, 'w'). Then you can traverse the…
arrow_forward
Average Number of WordsIf you have downloaded the source code from the Computer Science Portal you will find a filenamed text.txt in the Chapter 08 folder. The text that is in the file is stored as one sentenceper line. Write a program that reads the file’s contents and calculates the average number ofwords per sentence.(You can access the Computer Science Portal at www.pearsonhighered.com/gaddis.)
arrow_forward
Submission: Combine the code files for Q1 and Q2 as a zip file and submit in Moodle
Question 1: Write a Program that to enter Student Name, Grade and print it to the screen
with below requirements
.
.
.
.
Asks the users how many student grades they want to enter.
Based on that number the program should setup a loop to ask the user to
enter student name and the student grade.
Save this information using 2 arrays
At the end the program must show the student names and grades with 1
student on each line on the screen
Program should use Arrays and loops to achieve the task.
arrow_forward
Need help with this python program.
arrow_forward
In python please! I am struggling
arrow_forward
scanner format using java
please have the code copypaste
Create a program to count the word's length distribution of a text file. The program should read in the file row by row and split the row into words (assuming there is no punctuations). Then the program should count the number of strings of a certain length. For example, given the following file:
Mary has a little lamb
little lamb
little lamb
The result should be:
Length 1: 1
Length 3: 1
Length 4: 4
Length 6: 3
arrow_forward
$aprint
arrow_forward
PYTHONPLEASE ALSO SHARE CODE THROUGH LINK: online-python(dot)comAlso screenshot code with correct indentation
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…
arrow_forward
JAVA PPROGRAM ASAP
Hypergrade does not like this program because it says 2 out of 7 passed and take out the extra \n from the program. Please Modify and change this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram.
import java.io.File;import java.io.FileNotFoundException;import…
arrow_forward
pic for input and output
fname = "https://runestone.academy/runestone/books/published/StudentCSP/_static/beach.jpg"
arrow_forward
How many edges does your polygon have? 6 This is a hexagon. --- Sample run: This is a rectangle. Shape not recognized. How many edges does your polygon have? 3 This is a triangle.
I m posting this third time dont copy paste code
arrow_forward
3) Implement the if __name__ == "__main__" : block at the bottom of this file to do the following:
3a) The if main block at the bottom should get the name of the highway graph file from the command line arguments. See the video in Python that explains how to get command line arguments.
3b) Call your parse_highway_graph_file function to parse that file, and to construct a WeightedGraph object from it.
3c) Write some code that outputs (with print statements) the degree of each vertex. You can have one vertex per line, indicating its id (just its 0-based index) followed by its degree. IMPORTANT: Your parse_highway_graph_file function should NOT produce any output. You will have code in your if main block that will have the print statements. The WeightedGraph class has a degree method, inherited from Graph that will return to you the degree of a vertex.
arrow_forward
6. Average Number of WordsIf you have downloaded the source code from the Premium Companion Website you willfind a file named text.txt in the Chapter 08 folder. The text that is in the file is storedas one sentence per line. Write a program that reads the file’s contents and calculates theaverage number of words per sentence.
arrow_forward
I have already started working on it but I am now stuck on the remaining parts in the image and I need help with properly implementing the Changes that are needed listed in the image and having them work
Link to what I have so far
https://onlinegdb.com/C7-kfMDIM
arrow_forward
Python
A Personal Fitness Tracker is a wearable device that tracks your physical activity, calories burned, heart rate, sleeping patterns, and so on. One common physical activity that most ofthese devices track is the number of steps you take each day
The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and each line contains the number of steps taken during a day.
Write a program that reads the file, then displays the average number of steps taken for each month
Your program should use a function to calculatethe averagenumber of steps. You will need to pass more than one argument to the function.
arrow_forward
A shuttle van picks up passengers and drives them to a destination, where they leave the van. Store the names of the boarding passengers. Don't allow boarding if the van is full. Update the odometer when the van drives.
Complete the following file: (image)
-----------
Use the following files:
van.h
#ifndef VAN_H #define VAN_H #include <string> #include <vector> using namespace std; /** This class models a shuttle van. */ class Van { public: /** Constructs a van with a given capacity. @param max_passengers the maximum number of passengers that this van can hold */ Van(int max_passengers); /** Boards a passengers up to the capacity of this van. @param name the name of the passenger attempting to board */ void board(string name); /** Drives the van and discharges the passengers. @param distance the distance driven */ void drive(double distance); /** Gets the passengers in this van. @return the number of passengers */ vector<string> get_passengers() const; /** Gets the…
arrow_forward
A shuttle van picks up passengers and drives them to a destination, where they leave the van. Store the names of the boarding passengers. Don't allow boarding if the van is full. Update the odometer when the van drives.
Complete the following file: (image)
-----------
Use the following files:
van.h
#ifndef VAN_H #define VAN_H #include <string> #include <vector> using namespace std; /** This class models a shuttle van. */ class Van { public: /** Constructs a van with a given capacity. @param max_passengers the maximum number of passengers that this van can hold */ Van(int max_passengers); /** Boards a passengers up to the capacity of this van. @param name the name of the passenger attempting to board */ void board(string name); /** Drives the van and discharges the passengers. @param distance the distance driven */ void drive(double distance); /** Gets the passengers in this van. @return the number of passengers */ vector<string> get_passengers() const; /** Gets the…
arrow_forward
JAVA PPROGRAM ASAP
Please Modify this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases.
The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram.
Chapter 9. PC #10. Word Counter (page 610)
Write a program that asks the user for the name of a file. The program should display the number of words that the file contains.
Input…
arrow_forward
GirlNames.txt This file contains a list of the 200 most popular names given to girls born in the United States from the year 2000 through 2009.
BoyNames.txt This file contains a list of the 200 most popular names given to boys born in the United States from the year 2000 through 2009.
Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy’s name, a girl’s name, or both, and the application will display messages indicating whether the names were among the most popular.
**programming language is python**
** must use a def main(): function**
*please include some comments*
i aslo have the .txt files but no wya to upload them
arrow_forward
True or false
arrow_forward
PYTHON ONLYPlease finish off this movie collection progam/code a) define print_longest_moviesTo complete the interactive loop, you must instantiate a Movie object using the information provided by the user and add it to the MovieCollection object using the provided add_movie method.b) complete the interactive loop
This method is to take no arguments and print the title and duration of the top three longest movies in descending order (i.e. highest to lowest). Additionally, each movie should be numbered in the output (i.e. the longest movie is 1, the second longest is 2, etc). Here's an example of output which could be produced when print_longest_movies is called:
1. Titanic (194 minutes)2. Vertigo (128 minutes)3. Jaws (124 minutes) the code: class Movie:def __init__(self, title, duration):self.title = titleself.duration = durationdef get_movie_duration(movie):return movie.durationclass MovieCollection:def __init__(self):self.movies = []def add_movie(self,…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- *Code in Python A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies. Below is an example file along with the program input and output: example.txt I AM SAM I AM SAM SAM I AM Enter the input file name: example.txt AM 3 I 3 SAM 3 The program should handle input files of varying length (lines).arrow_forwardWhat does the following python code do? f = open("sample.txt", "w") Choose all that apply. Select 2 correct answer(s) Question 11 options: If the file called sample.txt exists, it writes at the bottom of the file if the file sample.txt exists, deletes everything in it reads the file called sample.txt starting from the top if the file sample.txt does not exist, it creates the file and opens it for writing opens a file called sample.txt for appending writes "w" to the file called sample.txt opens a file called sample.txt for reading closes a file called sample.txtarrow_forwardSearching - a user should be able to search by ID or by item name create only one menu item for searching a user should be able to enter the name of the item using any case, (for example, sTRolleR) you may wish to store items in all lower/upper case to expedite the search write one search function that can search by ID and name and goes through the array of structs/objects only once show the entire record if found or an appropriate message if not Sorting - sort by any field write one function to sort by any field using a parallel array of pointers use Bubble Sort is not the most effective but the easiest to modify. do not copy and paste sort code five times into the same function. sorting using pointers is faster because you have to swap pointers only, which are normally stored in 4 bytes each; it also allows you to preserve the original order of the items If you choose to have a submenu, a submenu must have an option to go back to the previous menu or main menu if a user got…arrow_forward
- Finish this program from the code posted below! Note: There should be two files Main.py and Contact.py You will implement the edit_contact function. In the function, do the following: Ask the user to enter the name of the contact they want to edit. If the contact exists, in a loop, give them the following choices Remove one of the phone numbers from that Contact. Add a phone number to that Contact. Change that Contact's email address. Change that Contact's name (if they do this, you will have to remove the key/value pair from the dictionary and re-add it, since the key is the contact’s name. Use the dictionary's pop method for this!) Stop editing the Contact Once the user is finished making changes to the Contact, the function should return. Code:from Contact import Contactimport pickledef load_contacts():""" Unpickle the data on mydata.dat and save it to a dictionaryReturn an empty dictionary if the file doesn't exist """try:with open("mydata.dat", 'rb') as file:return…arrow_forwardProblem: Write a Python program that reads from an input file named employees.txt some employee information and produces a salaries report on screen. The input file employees.txt has a number of data lines. Each data line in the input file contains information about one employee including: first name, last name, job code (an integer between 1 and 4), and the number of days worked. The following is an example of what the input file employees.txt can contain: Ali Al-Harthi 22 Laila Al-Busaidi 4 25 Salim Al-Hajri Badria Al-Sinani 2 21s 19 Abir Al-Hinai 1 15 Your program should produce a salaries report on screen using the format shown below. Enter input file name: employee.txt Name Job Code Days Worked Salary (OMR) Ali Al-Harthi 3 22 660.000 Laila Al-Busaidi 4 25 637.500 Abir Al-Hinai 15 600.000 Number of faulty records = 2 Number of valid records = 3 Average salary = 632.500 The salary of each employee is equal to the number of days worked multiplied by the daily pay rate. The daily pay…arrow_forward.arrow_forward
- please code in pythonredact_file: This function takes a string filename. It writes a new file that has the same contentsas the argument, except that all of the phone numbers are redacted. Assume that the filename has onlyone period in it. The new filename is the same as the original with '_redacted' added before theperiod. For instance, if the input filename were 'myfile.txt', the output filename would be'myfile_redacted.txt'. Make sure you close your output file.The first hard task in this function is to make the output filename from the input filename that waspassed in. You can break it into two pieces by splitting on the dot or by using the index method andslicing. Then put it back together again using string concatenation.We are also working with files in this one. To open a file with a filename stored in the variable fname,in read mode use the open function as such: fp = open(fname). You will need to open the outputfile in write mode: open(fname, 'w'). Then you can traverse the…arrow_forwardAverage Number of WordsIf you have downloaded the source code from the Computer Science Portal you will find a filenamed text.txt in the Chapter 08 folder. The text that is in the file is stored as one sentenceper line. Write a program that reads the file’s contents and calculates the average number ofwords per sentence.(You can access the Computer Science Portal at www.pearsonhighered.com/gaddis.)arrow_forwardSubmission: Combine the code files for Q1 and Q2 as a zip file and submit in Moodle Question 1: Write a Program that to enter Student Name, Grade and print it to the screen with below requirements . . . . Asks the users how many student grades they want to enter. Based on that number the program should setup a loop to ask the user to enter student name and the student grade. Save this information using 2 arrays At the end the program must show the student names and grades with 1 student on each line on the screen Program should use Arrays and loops to achieve the task.arrow_forward
- Need help with this python program.arrow_forwardIn python please! I am strugglingarrow_forwardscanner format using java please have the code copypaste Create a program to count the word's length distribution of a text file. The program should read in the file row by row and split the row into words (assuming there is no punctuations). Then the program should count the number of strings of a certain length. For example, given the following file: Mary has a little lamb little lamb little lamb The result should be: Length 1: 1 Length 3: 1 Length 4: 4 Length 6: 3arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education