Mylab Programming With Pearson Etext -- Access Code Card -- For Starting Out With Python
3rd Edition
ISBN: 9780133759112
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 8, Problem 7PE
If you have downloaded the source code you will find a file named text . txt in the Chapter 08 folder. Write a
▪ The number of uppercase letters in the file
▪ The number of lowercase letters in the file
▪ The number of digits in the file
▪ The number of whitespace characters in the file
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
If you have downloaded the source code from this book’s companion Web site, you will find a file named text.txt in the Chapter 08 folder. Write a program that reads the file’s contents and determines the following:• The number of uppercase letters in the file• The number of lowercase letters in the file• The number of digits in the file• The number of whitespace characters in the file
1. Create a text file using notepad2. Write few lines of text file in the file manually3. Save the file in C:\JAVA\ using the name LearnFile.txtTask• Write a program that will create File object for an input file named LearnFile.txt that contained in directory D:\JAVA\.• Create a method called display: This method will print out number of characters in the file• Create a method called countWords: this method will show the number of words in the file• Create a method called countLines to display the number of lines in the text• Write all the information about the number of characters, the number of words andthe number of lines to an output file called result.txt.
Chapter 4. PC #14. Line Numbers (page 265)
Write a java program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1. I should be easily type input1.txt and easily print out the output in Eclipse.
Please enter the file name or type QUIT to exit:\nquitENTER
Test Case 2
Please enter the file name or type QUIT to exit:\nbadfilename.txtENTERFile: badfilename.txt does not exist.\nPlease enter the file name again or type QUIT to exit:\nquitENTER
Test Case 3
Please enter the file name or type QUIT to exit:\ninput1.txtENTER1: a\n2: b\n3: c\n4: d\n
Chapter 8 Solutions
Mylab Programming With Pearson Etext -- Access Code Card -- For Starting Out With Python
Ch. 8.1 - Assume the variable name references a string....Ch. 8.1 - What is the index of the first character in a...Ch. 8.1 - If a string has 10 characters, what is the index...Ch. 8.1 - Prob. 4CPCh. 8.1 - Prob. 5CPCh. 8.1 - Prob. 6CPCh. 8.2 - Prob. 7CPCh. 8.2 - Prob. 8CPCh. 8.2 - Prob. 9CPCh. 8.2 - What will the following code display? mystring =...
Ch. 8.3 - Prob. 11CPCh. 8.3 - Prob. 12CPCh. 8.3 - Write an if statement that displays Digit" if the...Ch. 8.3 - What is the output of the following code? ch = 'a'...Ch. 8.3 - Write a loop that asks the user Do you want to...Ch. 8.3 - Prob. 16CPCh. 8.3 - Write a loop that counts the number of uppercase...Ch. 8.3 - Assume the following statement appears in a...Ch. 8.3 - Assume the following statement appears in a...Ch. 8 - This is the first index in a string. a. 1 b. 1 c....Ch. 8 - This is the last index in a string. a. 1 b. 99 c....Ch. 8 - This will happen if you try to use an index that...Ch. 8 - This function returns the length of a string. a....Ch. 8 - This string method returns a copy of the string...Ch. 8 - This string method returns the lowest index in the...Ch. 8 - This operator determines whether one string is...Ch. 8 - This string method returns true if a string...Ch. 8 - This string method returns true if a string...Ch. 8 - This string method returns a copy of the string...Ch. 8 - Once a string is created, it cannot be changed.Ch. 8 - You can use the for loop to iterate over the...Ch. 8 - The isupper method converts a string to all...Ch. 8 - The repetition operator () works with strings as...Ch. 8 - Prob. 5TFCh. 8 - What does the following code display? mystr =...Ch. 8 - What does the following code display? mystr =...Ch. 8 - What will the following code display? mystring =...Ch. 8 - Prob. 4SACh. 8 - What does the following code display? name = 'joe'...Ch. 8 - Assume choice references a string. The following...Ch. 8 - Write a loop that counts the number of space...Ch. 8 - Write a loop that counts the number of digits that...Ch. 8 - Write a loop that counts the number of lowercase...Ch. 8 - Write a function that accepts a string as an...Ch. 8 - Prob. 6AWCh. 8 - Write a function that accepts a string as an...Ch. 8 - Assume mystrinc references a string. Write a...Ch. 8 - Assume mystring references a string. Write a...Ch. 8 - Look at the following statement: mystring =...Ch. 8 - Initials Write a program that gets a string...Ch. 8 - Sum of Digits in a String Write a program that...Ch. 8 - Date Printer Write a program that reads a string...Ch. 8 - Prob. 4PECh. 8 - Alphabetic Telephone Number Translator Many...Ch. 8 - Average Number of Words If you have downloaded the...Ch. 8 - If you have downloaded the source code you will...Ch. 8 - Sentence Capitalizer Write a program with a...Ch. 8 - Prob. 9PECh. 8 - Prob. 10PECh. 8 - Word Separator Write a program that accepts as...Ch. 8 - Pig Latin Write a program that accepts a sentence...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
Write a single pseudocode statement that indicates each of the following: Display the message Enter two numbers...
C How to Program (8th Edition)
What do you call a program that translates a high-level language program into a separate machine language progr...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
When a classs member variables are declared private, how does code outside the class store values in, or retrie...
Starting Out with C++ from Control Structures to Objects (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 1. Modify exampleSix to read file tooutfile2.txt compute and display the total; then write the total to a file named tooutfile2A.txt exampleSix This program creates file tooutfile2.txt and stores 10 integers in it Please verify that the file was created along with the content package pwriter2; import java.util.Scanner; import java.io.*; public class Pwriter2 { public static void main(String[] args) throws IOException { PrintWriter tofile2 = new PrintWriter( "tooutfile2.txt" ); int i = 0; while (i < 10){ tofile2.println( i ); i = i + 1; } tofile2.close(); } }arrow_forwardOverviewYou should enter this task, ask the user for a word and then search for a file to see if that word is among the words in the file. Task Write a java programThis exercise comes with three text files named wordlist1.txt, wordlist2.txt and wordlist3.txt. These files contain a large amount of words in English. Each file contains more and more words. Each word in these files is on a separate line and the words contain only lowercase letters. Your task is to write a program that reads all these words from the file and checks if a keyword, which the user entered, is among the entered words. The program should also count the total number of words contained in the file used. The program should measure how long it takes to complete the search, ie how long it takes to read all the words and check if the keyword is among the words or not. The program should start by asking the user for the word to be searched for. Then the words in the file should be counted and compared if the keyword…arrow_forwardGiven file.txt that contains only one line as follows: I have a dream. What would be the printout of the following code? void print(fstream &file) { string s; while (file >> s) cout << s << endl;}int main() { fstream file("file.txt"); print(file); file.close(); return 0;} Group of answer choices I have a dream. I Ihaveadream. I have a dream.I have a dream.arrow_forward
- The problem is the following : Write a program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1. Please edit this scanner to JOptionPane. I don't really know how to do that. //Java Program by Yuiri Fujita and Darrick Drewry 10/30/2020 import java.util.Scanner;import java.io.*; public class LineNumbers { public static void main(String[] args) throws IOException {// TODO Auto-generated method stubScanner input = new Scanner(System.in);String userFileName;System.out.println("Please enter the name of the file.( Enter LineNumbers.txt)");userFileName = input.nextLine();File file = new File( userFileName);while( !file.exists() ){System.out.println( userFileName + " does not exist. Please enter a different file name");userFileName = input.nextLine();file = new File ( userFileName);}Scanner fileToScan = new Scanner (file);String line;int counter =…arrow_forwardCreate a flex file which recognizes if a given string is a word or a number. (Here we have 3 possibilities: word, number, other)Create a flex file which recognizes if a given string is an email address.Create a flex file which counts how many words start with a capital letter.Make calculator also run with float numbers.Create a calculator (multiplication, addition, division, extraction) for binary numbers.arrow_forwardOWrite a program that reads data from a file containing integers that ends with -999. Output the numbers that are divisible by 7 Output the numbers that are divisible by 11 Output the numbers that are not divisible by 7 or 11.arrow_forward
- Chapter 4. PC #14. Line Numbers (page 265) Write a program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1. Test Case 1 Please enter the file name or type QUIT to exit:\nquitENTER Test Case 2 Please enter the file name or type QUIT to exit:\nbadfilename.txtENTERFile: badfilename.txt does not exist.\nPlease enter the file name again or type QUIT to exit:\nquitENTER Test Case 3 Please enter the file name or type QUIT to exit: \ninput1.txt ENTER1: a\n2: b\n3: c\n4: d\narrow_forwarda file named numbers.txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that reads through the file, ignoring those valuse that are not bigger than the maximum value read up to that point. The numbers that are not ignored are added, and their sum stored in a variable called runsum. using python. rfile = open("numbers.txt", "r") maxvalue = 0 runsum = 0 data = rfile.readline() for data in rfile: if int(data) > maxvalue: maxvalue = int(data) runsum += int(data) my code so far. not sure what i am missingarrow_forwardWrite a Python program that opens a file called words.txt, processes it, and copies all of the lines that include the word "Coding" in it to a file called coding.txtThe words.txt file contains the following:Coding is cool.I hate coding.Coding helps me.This is Python.This is a program.Coding helps the time go by.The coding.txt file contains these lines:Coding is cool.Coding helps me.Coding helps the time go by.The program should also print out each line in the file being read.Sample Run:Coding is cool.Coding helps me.Coding helps the time go by.Process finished with exit code 0arrow_forward
- Using Python: Write a program that inputs a text file then counts the unique words in the file. Output each unique word and the number of times it occurs in the input file. Remove any spaces and punctuation from the data and convert each word to lowercase. https://rose.instructure.com/courses/11779/files/1799063?verifier=PeDzy7Z2p3NhCztKp6oaEJKkUa0z7vmWRyWQFchh&wrap=1 Sample Output: a 7 above 1 add 1 advanced 1 ago 1 all 1 altogether 1 and 6 any 1 are 3arrow_forwardC++ Add a search command that asks the user for a string and finds the first line that contains that string. The search starts at the first line currently displayed and stops at the end of the file. If the string is found, the line that contains it is displayed at the top. In case the user enters a string X that does not occur in the file, the program should print the error message: ERROR: string "X" was not found.arrow_forwardThe FKGLF is: 0.39(totalWords/totalSentences) + 11.8(totalSyllables/totalWords) - 15.59Using the FKGLF and your knowledge of how to input and output text files with Java, write an application that will: Take in a text file (anyText.txt), Correct the spelling then save to another file (anyTextCorrected.txt), Calculate the grade level. Outputs. Your solution needs to return: the number of words in the text, the number of spelling errors corrected with the misspelled words listed, the number of sentences in the text, the number of syllables in the text, and the Flesch-Kincaid Grade Level. One assumption you can make is the accuracy of SpellChecker(). You have access to the Java method SpellChecker that takes in a string, assumed to be a word, and returns a correctly spelled word. (Note: If the word returned is different than the word input, then there was a spelling error.) One Constraint: This program requires two classes: GradeLevel and GradeLevelTest. GradeLevel will be the…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License