friends
.py
keyboard_arrow_up
School
University Of Arizona *
*We aren’t endorsed by this school
Course
120
Subject
Computer Science
Date
Apr 3, 2024
Type
py
Pages
2
Uploaded by MateClover22302
'''
File: friends.py
Author: Nick Brobeck
Course: CSC 120, Spring Semester
Purpose: Handles social network operations. It reads network data, constructs a network using linked lists, and finds mutual friends. It's all about managing social connections.
'''
from linked_list import *
def build_network(filename):
"""
Constructs a social network from data stored in a file.
Parameters:
filename: A string representing the name of the file
containing the network data.
Returns:
LinkedList: A linked list representing the social network,
where each node corresponds to a person.
"""
network = LinkedList()
file = open(filename, 'r')
for line in file:
names = line.strip().split()
# Extract the two names from the line.
name1, name2 = names[0], names[1]
# Ensure both individuals are in the network;
# add them if they're not already present.
node_1 = network.find(name1)
if not node_1:
network.add(name1)
node_1 = network.find(name1)
node_2 = network.find(name2)
if not node_2:
network.add(name2)
node_2 = network.find(name2)
# Create a friendship between the two nodes.
add_friendship(node_1, node_2)
file.close()
return network
def find_mutual_friends(network, name1, name2):
"""
Finds mutual friends between two people in the network.
Parameters:
network: A linked list representing the social network.
name1: String representing the name of the first person.
name2: String representing the name of the second person.
"""
# Find the nodes in the network corresponding to the given names.
node_1 = network.find(name1)
node_2 = network.find(name2)
# If either person is not found in the network,
# print an error message and return.
if not node_1 or not node_2:
if not node_1:
print("ERROR: Unknown person", name1)
if not node_2:
print("ERROR: Unknown person", name2)
return
# Use set intersection to find mutual friends.
common_friends = set(node_1.friends) & set(node_2.friends)
if common_friends:
print("Friends in common:")
# Sort the Friends in common before printing.
for friend in sorted(common_friends):
print(friend)
def main():
input_file = input("Input file: ")
name1 = input("Name 1: ")
name2 = input("Name 2: ")
network = build_network(input_file)
find_mutual_friends(network, name1, name2)
main()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
www
Using c++ in sfml
make an login
interface
• Has two button one for child and other
for parents after clicking on it, it will
appear a new page to put a username
and password
arrow_forward
Rectangle's Length and Width
Code in C language
// WARNING: Do not add, remove, or change anything before the line 19 of this file.// Doing so will nullify your score for the activity.
#include <stdio.h>#include "rectangle.h"
int get_length(Rectangle *rect);int get_width(Rectangle *rect);
int main() { int ur_x, ur_y, ll_x, ll_y; printf("UR's X: "); scanf("%d", &ur_x); printf("UR's Y: "); scanf("%d", &ur_y); printf("LL's X: "); scanf("%d", &ll_x); printf("LL's Y: "); scanf("%d", &ll_y); // TODO: Initialize the points here // Point ... // TODO: Initialize the rectangle here // Rectangle ... // TODO: Call the get_length here int len = ___; printf("\nLength: %d", len); // TODO: Call the get_width here int wid = ___; printf("\nWidth: %d", wid); return 0;}
// TODO implement get_lengthint get_length(Rectangle *rect) { return 0;}
// TODO implement get_widthint get_width(Rectangle *rect){ return 0;}
refer to pics for instructions
arrow_forward
Program Specification
For this assignment you will write a program to help people record the events of their day by supplying prompts and then saving their responses along with the question and the date to a file.
Functional Requirements
This program must contain the following features:
Write a new entry - Show the user a random prompt (from a list that you create), and save their response, the prompt, and the date as an Entry.
Display the journal - Iterate through all entries in the journal and display them to the screen.
Save the journal to a file - Prompt the user for a filename and then save the current journal (the complete list of entries) to that file location.
Load the journal from a file - Prompt the user for a filename and then load the journal (a complete list of entries) from that file. This should replace any entries currently stored the journal.
Provide a menu that allows the user choose these options
Your list of prompts must contain at least five different prompts.…
arrow_forward
programming language: C++
How can you generate unique id with file handling and by using data structure like linked list or algorithm? System will search first in the file when it is not there, it will increment the largest number and then input it in the system whenever the user input a new video in the list.
The file will look like this:
101,Raya and the Last Dragon,Animation,Walt Disney Studio,6102,Captain America: The First Avenger,Adventure ,Marvel,10100,Captain America,Adventure ,Marvel,8
arrow_forward
C++
You should create a loop which will ask user if they want to insert, delete, display and exit. Then call the corresponding method based on the user's input. The loop will only stop once user entered "Exit"
Topic: LinkedList
arrow_forward
def swap_text(text):
Backstory:
Luffy wants to organize a surprise party for his friend Zoro and he wants to send a message to his friends, but he wants to encrypt the message so that Zoro cannot easily read it. The message is encrypted by exchanging pairs of characters.
Description: This function gets a text (string) and creates a new text by swapping each pair of characters, and returns a string with the modified text. For example, suppose the text has 6 characters, then it swaps the first with the second, the third with the fourth and the fifth with the sixth character.
Parameters: text is a string (its length could be 0)Return value: A string that is generated by swapping pairs of characters. Note that if the
Examples:
swap_text ("hello") swap_text ("Party for Zoro!") swap_text ("") def which_day(numbers):
→ 'ehllo'→ 'aPtr yof roZor!' → ''
length of the text is odd, the last character remains in the same position.
arrow_forward
Computer Science
Javascript
populateSelectMenu function
The function populateSelectMenu should exist.
The function populateSelectMenu should return undefined if it does not receive users data.
The function populateSelectMenu selects and returns the select menu.
The function populateSelectMenu receives the option elements from createSelectOptions and appends them to the select element.
arrow_forward
Boat Race
Define a class named BoatRace that contains the following information about a Boat Race:
race_name: string
race_id: int
distance: int
racers: List of Boat objects
Write a constructor that allows the programmer to create an object of type BoatRace with a race_name, race_id, list of racers objects, and distance.
The constructor will only take in one parameter, a string representing the name of a CSV file. The file will have the following format:
Each row will always have exactly two columns.
The first row will always contain the name of the race.
The second row will always contain the id number for the race.
The third row will always contain the distance for the race.
All remaining rows contain information about the boats involved in the race: the first column will be the name of the boat, and the second column is that boat’s top speed. For example, the race in the file below has two boats: The Fire Ball with top speed 12, and The Leaf with top speed 100.
Name,The…
arrow_forward
File System: It is highly useful in file system handling where for example
the file allocation table contains a sequential list of locations where the files
is split up and stored on a disk. Remember that overtime it is hard for an
OS to find disk space to cover the entire file so it usually splits these up into
chunks across the physical hard drive and stores a sequential list of links
together as a linked list.
Write an algorithm for the above problem and analyse the efficiency of
the algorithm.
arrow_forward
Data structures
flip_matrix(mat:list)->list
You will be given a single parameter a 2D list (A list with lists within it) this will look like a 2D matrix when printed out, see examples below. Your job is to flip the matrix on its horizontal axis. In other words, flip the matrix horizontally so that the bottom is at top and the top is at the bottom. Return the flipped matrix.
To print the matrix to the console:
print('\n'.join([''.join(['{:4}'.format(item) for item in row]) for row in mat]))
Example:
Matrix:
W R I T X
H D R L G
L K F M V
G I S T C
W N M N F
Expected:
W N M N F
G I S T C
L K F M V
H D R L G
W R I T X
Matrix:
L C
S P
Expected:
S P
L C
Matrix:
A D J
A Q H
J C I
Expected:
J C I
A Q H
A D J
arrow_forward
Assignment Submission Instructions:This is an individual assignment – no group submissions are allowed. Submit a script file that contains the SELECT statements by assigned date. The outline of the script file lists as follows:/* ******************************************************************************** * Name: YourNameGoesHere * * Class: CST 235 * * Section: * * Date: * * I have not received or given help on this assignment: YourName * ***********************************************************************************/USE RetailDB;####### Tasks: Write SQL Queries ######### -- Task 1 (Customer Information):-- List your SELECT statement below.
Make sure the SQL script file can be run successfully in MySQL and show the outcome of the code on MySQL
arrow_forward
A-Language- Python
Write a fully functioning program that correctly uses a list, reads, and writes from/to an external file.
Megan owns a small neighborhood coffee shop, and she has fifteen employees who work as baristas. All of the employees have the same hourly pay rate. Megan has asked you to design a program that will allow her to enter the number of hours worked by each employee and then display the amounts of all the employees’ gross pay. You determine that the program should perform the following steps:
The text that is in the file is stored as one sentence. Incorporate the code that reads the file’s contents and calculates the following:
total number of words in the file
total average number of words per sentence
total number of characters in the file
total average number of characters per sentence
Use function(s) to accommodate this word and character analysis of the file
B
For each employee:
Get the employee name from the file named employee_names.txt (attached in…
arrow_forward
C programming
c language
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
C++ Visual Studio 2019
Instructions
Complete #1 & #2. Please submit just one file for the classes and main to test the classes. Just create the classes before main and submit only one cpp file. Do not create separate header files. Please note: the deleteNode needs to initialize the *nodePtr and the *previousNode. The code to do this can be copied from here: ListNode *nodePtr, *previousNode = nullptr;
arrow_forward
Data structures
dict_from_string(dict_str:str)->dict
This function will be given a single parameter, a string representing a dictionary. Your job is to convert the string into an actual dictionary and return the dictionary. Make sure all key-value pairs in the string exist in the newly created dictionary. The string will contain only numbers or single letters as key values pairs. Make sure all letters are kept as strings and all numbers are converted to integers in the newly created dictionary.
Example:
String Input: '{9: 'V', 'G': 0, 'M': 9, 'u': 3, 2: 'o', 8: 'u', 'q': 9, 'D': 1}'
Expected: {9: 'V', 'G': 0, 'M': 9, 'u': 3, 2: 'o', 8: 'u', 'q': 9, 'D': 1}
String Input: '{10: 'D', 1: 'Z', 5: 'a'}'
Expected: {10: 'D', 1: 'Z', 5: 'a'}
String Input: '{'M': 2, 'V': 0, 3: 'x', 6: 'J', 5: 'J', 7: 'T', 8: 'P', 4: 'q', 1: 'h'}'
Expected: {'M': 2, 'V': 0, 3: 'x', 6: 'J', 5: 'J', 7: 'T', 8: 'P', 4: 'q', 1: 'h'}
String Input: '{3: 'D', 10: 'T', 7: 'm', 'u': 9, 't': 5, 6: 'Z', 'H': 10, 'B':…
arrow_forward
Python S3 Get File
In the Python file, write a program to get all the
files from a public S3 bucket named
coderbytechallengesandbox. In there
there might be multiple files, but your program
should find the file with the prefix
and
cb
-
then output the full name of the file. You
should use the boto3 module to solve this
challenge.
You do not need any access keys to access the
bucket because it is public. This post might
help you with how to access the bucket.
Example Output
ob
name.txt
Browse Resources
Search for any help or documentation you
might need for this problem. For exampler array
indexing, Ruby hash tables, etc.
arrow_forward
C++HurdleWords The HurdleWords class is mostly provided to you. HurdleWords is constructed from two files in the data/ folder: ● valid_guesses.txt (all 5 letter guesses considered to be valid words to guess), and ● valid_hurdles.txt (all words that may be selected to be the secret Hurdle.) ● Note: you may edit both text files if you’d like to add custom words to your game. HurdleWords stores all potential valid Hurdles from valid_hurdles.txt into a vector of strings (valid_hurdles_), and all valid guesses from valid_guesses.txt into an unordered set of strings (valid_guesses_). A set is simply a data structure that contains no duplicates and allows for a speedy lookup to check if a given element exists within the set. Because there are over 10,000 valid guesses, we store them in an unordered set to leverage their speediness, as you will need to check if a user-submitted guess is considered valid (i.e. their guess is considered a valid guess in the dictionary). You are responsible for…
arrow_forward
C++ Programming.
Associative and unordered associative containers.
Associative containers (set, map, multiset, multimap).
• When executing a given task, the input values must be read from a text file.
Task : Create a program that deletes a set of elements from a single word of a given string type and creates a second set of elements that consist of a single word, and also displays it on the screen.
arrow_forward
File Analysis
USING PYTHON- DICTIONARY
NOTE FIND ATTACHED BELOW 2 FILES THA SHOULD BE USED FOR THIS ASSIGNMENT
Using python, Write a program that reads the contents of two text files and compares them in the followingways:It should display a list of all the unique words contained in both files.It should display a list of the words that appear in both files.It should display a list of the words that appear in the first file but not the second.It should display a list of the words that appear in the second file but not the first.It should display a list of the words that appear in either the first or second file, but notboth.Hint: Use set operations to perform these analyses.
ATTACHED FILES
first FILENAME: first_file.txt
The quick brown fox jumps over the lazy dog.
Second FILENAME: second_file.txt
Jack be nimble, Jack be quick, Jack jump over the candlestick.
. For the program, you need to write:
Comments for all the values, constants, and functions
IPO
Variables
Pseudocode
arrow_forward
Problem description
Write a program that will read in a file of student academic credit data and create a list
of students on academic warning. The list of students on warning will be written to a file.
Each line of the input file will contain the student name (a single String with no spaces), the
number of semester hours earned (an integer), the total quality points earned (a double).
The program should compute the GPA (grade point or quality point average) for each student
(the total quality points divided by the number of semester hours) then write the student
information to the output file if that student should be put on academic warning. A student
will be on warning if he/she has a GPA less than 1.5 for students with fewer than 30 semester
hours credit, 1.75 for students with fewer than 60 semester hours credit, and 2.0 for all other
students. Do the following:
1. Create a text data file "students.dat". The following shows part of a typical data file:
Smith 27 83.7
Jones 21 28.35…
arrow_forward
Problem description
Write a program that will read in a file of student academic credit data and create a list
of students on academic warning. The list of students on warning will be written to a file.
Each line of the input file will contain the student name (a single String with no spaces), the
number of semester hours earned (an integer), the total quality points earned (a double).
The program should compute the GPA (grade point or quality point average) for each student
(the total quality points divided by the number of semester hours) then write the student
information to the output file if that student should be put on academic warning. A student
will be on warning if he/she has a GPA less than 1.5 for students with fewer than 30 semester
hours credit, 1.75 for students with fewer than 60 semester hours credit, and 2.0 for all other
students. Do the following:
arrow_forward
State True/False: A set may contain a specific value more than once, however, only unique value will be stored.
True
False
arrow_forward
JAVA INTRO
Create a program that generates a report that displays a list of students, classes they are enrolled in and the professor who teaches the class.
There are 3 files that provide the input data:
1. FinalRoster.txt
List of students and professors ( The first value of each row indicates if it is a student or professor; S means a student , P means a professor)
Student and Professor have different data
Student row: "S",Student Name, StudentID
Professor row: "P", Professor Name, Professor ID, Highest Education
2. FinalClassList.txt
List of classes and professor who teach them
Each row contains the following information: ClassID, ClassName, ID of Professor who teach that class
The professor ID in this file matches the Professor ID in FinalRoster.txt.
3. FinalStudentClassList.txt
List of classes the students are enrolled in. (StudentID, ClassID)
Student ID matches Student ID in FinalRoster.txt and ClassID matches Class ID in FinalClassList.txt
The output shall be…
arrow_forward
Python
arrow_forward
flip_matrix(mat:list)->list
You will be given a single parameter a 2D list (A list with lists within it) this will look like a 2D matrix when printed out, see examples below. Your job is to flip the matrix on its horizontal axis. In other words, flip the matrix horizontally so that the bottom is at top and the top is at the bottom. Return the flipped matrix.
To print the matrix to the console:
print('\n'.join([''.join(['{:4}'.format(item) for item in row]) for row in mat]))
Example:
Matrix:
W R I T X
H D R L G
L K F M V
G I S T C
W N M N F
Expected:
W N M N F
G I S T C
L K F M V
H D R L G
W R I T X
Matrix:
L C
S P
Expected:
S P
L C
Matrix:
A D J
A Q H
J C I
Expected:
J C I
A Q H
A D J
arrow_forward
//19. selectMenuChangeEventHandler//a. Dependencies: getUserPosts, refreshPosts//b. Should be an async function//c. Automatically receives the event as a parameter (see cheatsheet)//d. Defines userId = event.target.value || 1; (see cheatsheet)//e. Passes the userId parameter to await getUserPosts//f. Result is the posts JSON data//g. Passes the posts JSON data to await refreshPosts//h. Result is the refreshPostsArray//i. Return an array with the userId, posts and the array returned from refreshPosts://[userId, posts, refreshPostsArray]
This is what I have but it fails help please
const selectMenuChangeEventHandler = async (e) => { let userId = e?.target?.value || 1; let posts = await getUserPosts(userId); let refreshPostsArray = await refreshPosts(posts); return [userId, posts, refreshPostsArray];}
arrow_forward
Python Programming
arrow_forward
Phyton:
Program 6:
Write a program that allows the user to add data from files or by hand. The user may add more data whenever they want. The print also allows the user to display the data and to print the statistics. The data is store in a list. It’s easier if you make the list global so that other functions can access it.
You should have the following functions:
· add_from_file() – prompts the user for a file and add the data from it.
· add_by_hand() – prompts the user to enter data until user type a negative number.
· print_stats() – print the stats (min, max, mean, sum). You may use the built-in functions.
Handling errors such as whether the input file exist is extra credit.
To print a 10-column table, you can use the code below:
for i in range(len(data)):
print(f"{data[i]:3}", end="")
if (i+1)%10==0:
print()
print()
Sample run:
Choose an action
1) add data from a file
2) add data by hand
3) print stats
4)…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Related Questions
- www Using c++ in sfml make an login interface • Has two button one for child and other for parents after clicking on it, it will appear a new page to put a username and passwordarrow_forwardRectangle's Length and Width Code in C language // WARNING: Do not add, remove, or change anything before the line 19 of this file.// Doing so will nullify your score for the activity. #include <stdio.h>#include "rectangle.h" int get_length(Rectangle *rect);int get_width(Rectangle *rect); int main() { int ur_x, ur_y, ll_x, ll_y; printf("UR's X: "); scanf("%d", &ur_x); printf("UR's Y: "); scanf("%d", &ur_y); printf("LL's X: "); scanf("%d", &ll_x); printf("LL's Y: "); scanf("%d", &ll_y); // TODO: Initialize the points here // Point ... // TODO: Initialize the rectangle here // Rectangle ... // TODO: Call the get_length here int len = ___; printf("\nLength: %d", len); // TODO: Call the get_width here int wid = ___; printf("\nWidth: %d", wid); return 0;} // TODO implement get_lengthint get_length(Rectangle *rect) { return 0;} // TODO implement get_widthint get_width(Rectangle *rect){ return 0;} refer to pics for instructionsarrow_forwardProgram Specification For this assignment you will write a program to help people record the events of their day by supplying prompts and then saving their responses along with the question and the date to a file. Functional Requirements This program must contain the following features: Write a new entry - Show the user a random prompt (from a list that you create), and save their response, the prompt, and the date as an Entry. Display the journal - Iterate through all entries in the journal and display them to the screen. Save the journal to a file - Prompt the user for a filename and then save the current journal (the complete list of entries) to that file location. Load the journal from a file - Prompt the user for a filename and then load the journal (a complete list of entries) from that file. This should replace any entries currently stored the journal. Provide a menu that allows the user choose these options Your list of prompts must contain at least five different prompts.…arrow_forward
- programming language: C++ How can you generate unique id with file handling and by using data structure like linked list or algorithm? System will search first in the file when it is not there, it will increment the largest number and then input it in the system whenever the user input a new video in the list. The file will look like this: 101,Raya and the Last Dragon,Animation,Walt Disney Studio,6102,Captain America: The First Avenger,Adventure ,Marvel,10100,Captain America,Adventure ,Marvel,8arrow_forwardC++ You should create a loop which will ask user if they want to insert, delete, display and exit. Then call the corresponding method based on the user's input. The loop will only stop once user entered "Exit" Topic: LinkedListarrow_forwarddef swap_text(text): Backstory: Luffy wants to organize a surprise party for his friend Zoro and he wants to send a message to his friends, but he wants to encrypt the message so that Zoro cannot easily read it. The message is encrypted by exchanging pairs of characters. Description: This function gets a text (string) and creates a new text by swapping each pair of characters, and returns a string with the modified text. For example, suppose the text has 6 characters, then it swaps the first with the second, the third with the fourth and the fifth with the sixth character. Parameters: text is a string (its length could be 0)Return value: A string that is generated by swapping pairs of characters. Note that if the Examples: swap_text ("hello") swap_text ("Party for Zoro!") swap_text ("") def which_day(numbers): → 'ehllo'→ 'aPtr yof roZor!' → '' length of the text is odd, the last character remains in the same position.arrow_forward
- Computer Science Javascript populateSelectMenu function The function populateSelectMenu should exist. The function populateSelectMenu should return undefined if it does not receive users data. The function populateSelectMenu selects and returns the select menu. The function populateSelectMenu receives the option elements from createSelectOptions and appends them to the select element.arrow_forwardBoat Race Define a class named BoatRace that contains the following information about a Boat Race: race_name: string race_id: int distance: int racers: List of Boat objects Write a constructor that allows the programmer to create an object of type BoatRace with a race_name, race_id, list of racers objects, and distance. The constructor will only take in one parameter, a string representing the name of a CSV file. The file will have the following format: Each row will always have exactly two columns. The first row will always contain the name of the race. The second row will always contain the id number for the race. The third row will always contain the distance for the race. All remaining rows contain information about the boats involved in the race: the first column will be the name of the boat, and the second column is that boat’s top speed. For example, the race in the file below has two boats: The Fire Ball with top speed 12, and The Leaf with top speed 100. Name,The…arrow_forwardFile System: It is highly useful in file system handling where for example the file allocation table contains a sequential list of locations where the files is split up and stored on a disk. Remember that overtime it is hard for an OS to find disk space to cover the entire file so it usually splits these up into chunks across the physical hard drive and stores a sequential list of links together as a linked list. Write an algorithm for the above problem and analyse the efficiency of the algorithm.arrow_forward
- Data structures flip_matrix(mat:list)->list You will be given a single parameter a 2D list (A list with lists within it) this will look like a 2D matrix when printed out, see examples below. Your job is to flip the matrix on its horizontal axis. In other words, flip the matrix horizontally so that the bottom is at top and the top is at the bottom. Return the flipped matrix. To print the matrix to the console: print('\n'.join([''.join(['{:4}'.format(item) for item in row]) for row in mat])) Example: Matrix: W R I T X H D R L G L K F M V G I S T C W N M N F Expected: W N M N F G I S T C L K F M V H D R L G W R I T X Matrix: L C S P Expected: S P L C Matrix: A D J A Q H J C I Expected: J C I A Q H A D Jarrow_forwardAssignment Submission Instructions:This is an individual assignment – no group submissions are allowed. Submit a script file that contains the SELECT statements by assigned date. The outline of the script file lists as follows:/* ******************************************************************************** * Name: YourNameGoesHere * * Class: CST 235 * * Section: * * Date: * * I have not received or given help on this assignment: YourName * ***********************************************************************************/USE RetailDB;####### Tasks: Write SQL Queries ######### -- Task 1 (Customer Information):-- List your SELECT statement below. Make sure the SQL script file can be run successfully in MySQL and show the outcome of the code on MySQLarrow_forwardA-Language- Python Write a fully functioning program that correctly uses a list, reads, and writes from/to an external file. Megan owns a small neighborhood coffee shop, and she has fifteen employees who work as baristas. All of the employees have the same hourly pay rate. Megan has asked you to design a program that will allow her to enter the number of hours worked by each employee and then display the amounts of all the employees’ gross pay. You determine that the program should perform the following steps: The text that is in the file is stored as one sentence. Incorporate the code that reads the file’s contents and calculates the following: total number of words in the file total average number of words per sentence total number of characters in the file total average number of characters per sentence Use function(s) to accommodate this word and character analysis of the file B For each employee: Get the employee name from the file named employee_names.txt (attached in…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr