MYPROGRAMMINGLAB WITH PEARSON ETEXT
8th Edition
ISBN: 9780134225340
Author: Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 11, Problem 11.18E
Program Plan Intro
Program plan:
- Modify program textFile as follows:
- Include one additional parameter ch of type int.
- Within the else contruct, based on value of ch call frprintf or printf to display the header for account information.
- Within the while loop of else construct, based on value of ch use fprintf or printf to display the content of client variable.
- Modify program enterChoice as follows:
- Include one additional statement of choice i.e. 5- Display accounts on screen.
- Modify the main function as follows:
- Run the while loop till choice is not equal to 6.
- Modifiy call of textFile in case 1 to provide the function additional argument i.e. choice.
- Include case 5 to call the textFile function with additional argument i.e. choice.
Program description:
This program is the modified version of transaction processing program given in figure 11.15 of the book.This program included one more option i.e. to print the account details on screen instead of text file in addition to all other option of program in figure 11.15.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Class Average: Reading Student Records from a CSV File) Use Python
Use the csv module to read the grades.csv file from the previous exercise (exercise 9.3).
Display the data in tabular format, including an additional column showing each student’s average to the right of that student’s three exam grades and an additional row showing the class average on each exam below that exam’s column.
This is exercise 9.3
# Importing csv moduleimport csv# empty list to store datadata = []columns = ["firstname", "lastname", "grade1", "grade2", "grade3"]filename = "grades.csv"for i in range(3):firstname = input("Enter First Name : ")lastname = input("Enter Last Name : ")grade1 = float(input("Enter Grade 1 : "))grade2 = float(input("Enter Grade 2 : "))grade3 = float(input("Enter Grade 3 : "))data.append([firstname, lastname, grade1, grade2, grade3])print()# write data and columns as csv filewith open(filename, 'w') as csvfile:# creating a csv writer objectcsvwriter = csv.writer(csvfile)# writing the…
(python) Write a function startWith(File, Let) that takes a file name and a letter. Each
line in the file contains 1 word. The function should store a new file with all the
words that start with letter Let.
Example:
startWith (‘Test1-3.txt’, ‘A’)
Source File: (Test1-3.txt)
Output File: (Test1-3New.txt)
Hi
Airport
Airport
Apple
Hello
Apple
Mango
(JS)Write a function named "tweets" that takes a string as a parameter. If a message can hold at most 280 characters, calculate the smallest number of messages needed to hold all of the text in the input. The function should return the number it calculated.
Chapter 11 Solutions
MYPROGRAMMINGLAB WITH PEARSON ETEXT
Ch. 11 - Prob. 11.5ECh. 11 - Prob. 11.6ECh. 11 - (Creating Data for a File-Matching Program) Write...Ch. 11 - (File Matching) Exercise 11.3 asked the reader to...Ch. 11 - (Testing the File-Matching Exercises) Run the...Ch. 11 - Prob. 11.10ECh. 11 - (Write Statements to Accomplish a Task) Write...Ch. 11 - (Hardware Inventory) Youre the owner of a hardware...Ch. 11 - (Telephone-Number Word Generator) Standard...Ch. 11 - Prob. 11.14E
Knowledge Booster
Similar questions
- 1. (True/False) A function is invoked with a call statement, as in call check( guess );arrow_forward(Displaying a Square of Any Character) Modify the function created in Exercise 5.19 toform the square out of whatever character is contained in character parameter fillCharacter. Thusif side is 5 and fillCharacter is “#”, then this function should print: ##### ##### ##### ##### #####arrow_forward(IN PYTHON) Problem 1 Write a function word_count() that performs the following actions: Opens a file called “novel.txt”. You can assume that the file exists and is located in the same directory as your code file. Reads in the contents of the file, and stores it in a variable called text. Uses the split() function to obtain a list containing all of the individual words in text. For details on how to use split(), you can consult this site: https://www.w3schools.com/python/ref_string_split.asp For this question, assume that all words will be separated by spaces. Returns the number of words in the lisarrow_forward
- (Use Python) Use the Design Recipe to define a function called black_jack which consumes to 2 int values greater than 0. Return whichever value is nearest to 21 without going over. Return 0 if they both go over. Include a docstring! For example: Test Result print(black_jack(19, 21)) 21 print(blackjack(21, 19)) 21 print(black_jack(19, 22)) 19 Write three assert_equal statements to test your function.arrow_forwardModified Programming ). (Count vowels and consonants, file input, nested-loops, switch statement) Assume that letters A, E, I, O and U are the vowels. Write a program that reads strings from a text file, one line at a time, using a while-loop. You do the following operations within each loop: • Read one line from the input file and store it in a string; Count the number of vowels and consonants (using either while-loop or for-loop) in the file string. The while-loop will terminate when the end-of-file is reached. After the loop is finished, the program displays the total number of vowels and consonants in the text file. [A text file, named “ass4_Q6_input.txt", is provided as your testing input file.]arrow_forwardDO NOT WRITE MAIN! Only write the function. A 50% minimum deduction will be made if main is included. No libraries or comments should be specified. (OP4) Write a function to prompt the user for the filename, open the file, and verify that it opened. If the file does not open, an error message should be printed and the user re-prompted. The function should use the string passed in for the prompt string. The function should not return until the file is open. The function prototype: void openInputFile( ifstream &, string ); ifstream& - the stream to be opened. string - the prompt to be written out to the user. Use this string when prompting the user.arrow_forward
- (python) 9. Create a function based on the following information: You are given two strings with words separated by commas. Try to find what is common between these strings. The words in the same string don't repeat. Your function should find all of the words that appear in both strings. The result must be represented as a string of words separated by commas in alphabetic order. Input: Two arguments as strings. Output: The common words as a string. Return: Nothing is returnedarrow_forward4. (Prime Numbers) An integer is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime, but 4, 6, 8 and 9 are not. Write a function called isPrime that receives an integer and determines whether the integer is prime or not. Write a test program that uses isPrime to determine and prints all the prime numbers between 1 and 1000. Display 10 numbers per line.arrow_forward(Use Python) Use the Design Recipe to write a function called which_day that consumes an int representing the number of days that have passed since Friday and returns name of the current day of the week. For example, if 2 days have passed, then ‘Sunday’ should be returned. Include a docstring! For example: Test Result 2 Sunday 4 Tuesday 6 Thursday 8 Saturday 10 Monday Write 3 assert_equal statements to test your function.arrow_forward
- (FRP7) Write a function that reads data from a file. The file has already been opened and verified. The data should be saved in the array of type ship. The size of the array is passed in the int parameter and the number of records read is return in the last parameter, by reference. The file should be read until end of file has been reached or the array is full. struct ship{ string shipCaptain; string shipName; }; The function prototype isvoid readFile( ifstream&, ship[ ], int, int& ); ifstream - The already open file ship[ ] - array of structs where the data from the file will be stored. int - the size of the array. int& - the number of records read from the file. This value is set by the function before returning return- the number of records read from the file, returned by the function. The amount of data in the file is unknown but there is no bad data. The file format is the shipsName followed by the shipsCaptiain . Example: MillenniumFalcon HansSoloarrow_forward(Difficulty Level 3)Write a function frequency_match(text, chars) that receives a string text and a dictionary chars that has characters as keys and numbers as values. The function must return a list with all the characters that occur in the text as many times as their associated value in the char dictionary. Not all the chars in the text will be present in the dictionary, but you may assume that all the chars in the dictionary are in the text. You are allowed to change the values in the dictionary. solve using pythonarrow_forwardExercise 1. (Spell Checker) Write a program spell_checker.py that accepts words from standard input; looks up each word in the file data/misspellings.txt that maps misspelled words to their correct spellings; and if it exists (ie, is misspelled), writes the word to standard output along with the correct spelling. >- "/workspace/project6 $ python3 spell_checker.py Try nto to become a man of sucess but rather try to become man of value. * Albert Einstein nto -> not sucess -> success E spell.checker.py from instream import InStream from symboltable import SymbolTable import stdio # Entry point. def main (): # Set inStream to an input stream built from the file 'data/misspellings.txt'. # Set lines to the list of lines read from inStream. .. # Set misspellings to a new symbol table object. .. for in ...: # For each line (of the form 'misspelling correction ') in lines... # Set tokens to the list obtained by splitting line using the split () method from str. # Insert the pair tokens…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning