subject

This question involves a class named filetext that represents a text file. 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 // even index positions, including 0, 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: [one, mary, two, had, three, a, little, lamb]complete the filesize and mergewords methods below. be sure to include the method headers.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:40
It is vital to research each of the services you plan to disable before implementing any change, especially on critical machines such as the: a. servers in the test environment. b. domain controller and other infrastructure servers. c. desktops that have previously been attacked. d. desktops used by upper-level management.
Answers: 2
question
Computers and Technology, 22.06.2019 12:10
Linux is distributed under gnu gpl. why is this important? a. it ensures that only torvalds can profit from the sale of linux b. it prevents unknowledgeable users from downloading programs they don't know how to operate. c. it provides protection for the developers who created linux. d. it states that anyone can copy, modify, and share the program if changes are made public.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
question
Computers and Technology, 23.06.2019 05:00
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
You know the right answer?
This question involves a class named filetext that represents a text file. public class filetext { p...
Questions
question
Mathematics, 11.06.2020 01:57
question
Mathematics, 11.06.2020 01:57
question
Mathematics, 11.06.2020 01:57
question
Mathematics, 11.06.2020 02:57
Questions on the website: 13722363