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 10:30
This first part of the film shows the early history of motion pictures. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theatre productions? explain. in the scene where don is going to the party (starting at time code 14: 51), we see a street scene as he first rides with cosmo and then with kathy. what aspects did the filmmaker include to make the scene look and feel like don, cosmo, and kathy are riding in a car on a street? think about elements such as scenery, sound, props, lighting, and so on. a "talkie" picture is shown starting around time code 21: 15. how does the audience in the film react to the "talkie"? what influence do audiences have on film and theatre performances? how do film and theatre actors influence audiences? in the musical scene with cosmo (starting at time code 27: 00), how does the actor use props? what is the result? do you think the use of props effectively fulfilled the artistic vision for this musical number? why or why not?
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
question
Computers and Technology, 24.06.2019 00:40
What social factors affect your health
Answers: 3
question
Computers and Technology, 24.06.2019 01:30
Suppose a cpu with a write-through, write-allocate cache achieves a cpi of 2. what are the read and write bandwidths (measured by bytes per cycle) between ram and the cache? (assume each miss generates a request for one block.)
Answers: 1
You know the right answer?
Public class filetext { private string filename; private int filebytes; private arraylist‹string›...
Questions
question
Chemistry, 06.10.2019 07:01