subject

Public class filetext { private string filename; private int filebytes; private arraylist‹string› wordlist; // the contents of the text file // constructors not shown // postcondition: calculates the number of bytes in this file and updates // the instance variable filebytes public void filesize() { } // precondition: 0 < newwords. length < wordlist. size () // postcondition: elements from the newwords array are placed into consecutive // odd index positions of the wordlist arraylist // postcondition: the value of filebytes is updated public void mergewords(string[] newwords) { } // other methods not shown }the wordlist arraylist stores the words (tokens) found in a text file. suppose wordlist contains the following elements: [mary, had, a, little, lamb]the filesize method; the size of the file is computed in bytes. each character in a word counts as one byte. in addition, there is a space in between each word, and each of those spaces also counts as one byte. for the example above, the filesize method would compute 4 + 3 + 1 + 6 + 4 as the sum of the lengths of each string in the arraylist. the value of filebytes would be this sum plus 4, because there would be 4 spaces in between the 5 words. for the mergewords method, assume the values for the newwords array are as follows: {"one", "two", "three"}after the method has executed, filebytes will have an updated value, and wordlist would contain the following elements: [mary, one, had, two, a, three, little, lamb]

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
Asoftware company hired ray, a college graduate to work in their development team. ray is assigned to work in the coding phase of a project. what happens during the coding phase of a software development project? a. the customer receives a working model of the software. b. developers convert the program design into code. c. developers gather requirements directly from the stakeholders. d. testing teams check the product for quality.
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
Now, open this passage to read about fafsa requirements. describe the information you will need to provide in order to complete a fafsa. list at least three of the required documents you must include.
Answers: 3
question
Computers and Technology, 24.06.2019 00:10
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
You know the right answer?
Public class filetext { private string filename; private int filebytes; private arraylist‹string›...
Questions
question
Computers and Technology, 18.09.2019 12:20
question
Mathematics, 18.09.2019 12:20
Questions on the website: 13722363