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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, taniyahreggienae
What is the most important aspect of marking media? a. data labelingb. content descriptionc. electronic labelingd. classification
Answers: 2
image
Computers and Technology, 23.06.2019 15:00, abelxoconda
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
image
Computers and Technology, 24.06.2019 09:10, daedae11142
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
image
Computers and Technology, 24.06.2019 17:30, NEONREDBLADE
Match the following. 1. formatting that is applied when cell data meets certain criteria 2. borders with formats not found on the border tool 3. a shortcut bar that contains tools for commonly used formats 4. formats that can be applied to numbers conditional formatting custom borders format bar number formats
Answers: 3
You know the right answer?
Public class filetext { private string filename; private int filebytes; private arraylist‹string›...

Questions in other subjects: