Programming with Microsoft Visual Basic 2017
8th Edition
ISBN: 9781337102124
Author: Diane Zak
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 9, Problem 3RQ
Which of the following reads a line of text from a sequential access file and assigns the line (excluding the newline character) to the strText variable?
- a. inFile.Read(strText)
- b. inFile.ReadLine(strText)
- c. strText = inFile.ReadLine
- d. strText = inFile.Read(line)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The File class contains file input and output operations. In other words, you can
use the File class to read and write content from and to files.
True
False
Using C++ Language
Create a file called input9B.txt and type (or copy) the following text exactly as it appears below into that file. You may cut and paste the following 7 blue lines (including the blank line between the two paragraphs) into that file: C++ is a cross-platform language that can be used to create high-performance applications. C++ was developed by Bjarne Stroustrup, as an extension to the C language. C++ gives programmers a high level of control over system resources and memory. C++ is one of the world's most popular programming languages. C++ can be found in today's operating systems, Graphical User Interfaces, and embedded systems. C++ is an object-oriented programming language which gives a clear structure to programs and allows code to be reused, lowering development costs.
Compile and run the program, using the input9B.txt file as the input file. Did this program produce the same exact output as shown above? What do you think the problem is? The problem is…
The python function get_second_line takes one parameter, fname, the name of a text file. The function should open the file for reading, determine the second line of the file, close the file, and return the second line (a string).
NOTE: You may assume the file will have at least two lines.
Chapter 9 Solutions
Programming with Microsoft Visual Basic 2017
Ch. 9 - Which of the following opens the employ.txt file...Ch. 9 - If the file to be opened exists, which method...Ch. 9 - Which of the following reads a line of text from a...Ch. 9 - What type of object is created by the OpenText...Ch. 9 - Prob. 7RQCh. 9 - The horizontal line in a menu is called _____.
a...Ch. 9 - Prob. 9RQCh. 9 - Prob. 10RQCh. 9 - Prob. 11RQCh. 9 - Prob. 3E
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
- Slide Type Slide • Exercise # 4 A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: • The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), • The amount of the sale, and the date of that event. • Write a program that reads such a file and displays the total amount for each service category. Display an error if the file does not exit or the format of the record is incorrect. No need to display anything else in this regard. Note that you can assume that the dates are entered correctly (no need to validate them). You may also assume that the name of the input text file is inputex4.txt. • Make sure you use a dictionary in your solution. • Sample run is included below for the given input file inputex4.txt Summary of total sales according to services Dinner 634.75 Conference 1133.25 Lodging Dinner and Lodging 550.25 625.14 Slide Tyne Fragment varrow_forwardCODE IN PYTHON PLEASE The objective is to create a code in Python that can extract the columns highlighted in blue (Column T and AB3) and output them to a .txt file. The code should be able to generate the text file with the columns that are highlighted in blue and store them on a separate folder. Below shows how the Test.xlsm file looks like as well as how the text file should look like when the code extracts and outputs it. Google drive to access Test.xlsm file: https://drive.google.com/drive/folders/16utzb5_h7yMCN8_13E_JqasfcpykZOYr?usp=sharing What my code outputs is shown in the picture (O1.png) What I would like for my code to output is the columns next to each other (Right Example.png) The current code is able to output Columns T and AB3 but I am not able to output them next to each other as shown above. We would also like for the code to be capable of storing the text file to a separate folder. Below is the code I have been working on. #package to read xlsm file import openpyxl…arrow_forwardMC 2 A text file contains: Ana Bob Cpc aaX bBy cCz Aba Bub Cxc Write a regular expression that will match only lines 1, 2, and 3.arrow_forward
- Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file .Prompt the user to enter the - Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file When you create the file, prompt the user for the name they want to give the file Separate the items saved with commas Each entry should be on a separate line in the text file Ask the user if they have more items to enter Once the user has finished entering items Close the file with the items entered Display the sales total If the sales total is more than $100 Calculate and display a 10% discount Calculate and display the sales tax using 8% as the sales tax rate The sales tax should be calculated on the sales total after the discount Display the total for the sales receiptarrow_forwardA file named data.txt contains an unknown number of lines, each consisting of a single integer. Write a program that creates the following three files: dataplus.txt dataminus.txt zeros.txt The program should read each line of the data.txt file and perform the following: If the line contains a positive number, that number should be written to the dataplus.txt file. If the line contains a negative number, that number should be written to the dataminus.txt file. If the line contains the value 0, do not write the value to a file. Instead, keep a count of the number of times 0 is read from the data.txt file. After all the lines have been read from the data.txt file, the program should write the count of zeros to the zeros.txt file.arrow_forwardCreate a new text file using a notepad or any other software, The text file contains your name(first 8 chars) and the file must be exactly 8 bytes in size only and name it “your_ID.txt”.arrow_forward
- IN PYTHON LANGUAGEarrow_forward1. Write a program that opens an output file with the filename my_name.txt, writes your name to the file, then closes the file. 2. Write a program that opens the my_name.txt file that was created by the program in problem 1, reads your name from the file, displays the name on the screen, then closes the file. Write code that does the following: opens an output file with the filename number_list.arrow_forwardYou develop a Python application for your school.You need to read and write data to a text file. If the file does not exist, it must be created. If the file has content, the content must be removed.Which code should you use? Group of answer choices C. open(“local_data”, “w+”) D. open(“local_data”, “w”) A. open(“local_data”, “r”) B. open(“local_data”, “r+”arrow_forward
- What is the most effective method for updating a string that is already present in a file?arrow_forwardWrite code that opens an output file with the filename number_list.txt, but does not erase the file’s contents if it already exists.arrow_forwardgetline(myfile,str); * 2 points writes a line of text str from the file myfile reads a line of text to str from the file myfile writes a character str to the file myfile reads a character str from the file myfilearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Linux - Tutorial for Beginners in 13 MINUTES! [ UPDATED ]; Author: bai;https://www.youtube.com/watch?v=BMGixkvJ-6w;License: Standard YouTube License, CC-BY
What is Linux?; Author: Techquickie;https://www.youtube.com/watch?v=zA3vmx0GaO8;License: Standard YouTube License, CC-BY
Introduction to Linux and Basic Linux Commands for Beginners; Author: sakitech;https://www.youtube.com/watch?v=IVquJh3DXUA;License: Standard Youtube License