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
// 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]
complete the filesize and mergewords methods below. be sure to include the method headers.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
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, 22.06.2019 23:00
Suppose s, t, and w are strings that have already been created inside main. write a statement or statements, to be added to main, that will determine if the lengths of the three strings are in order by length, smallest to largest. that is, your code should determine if s is strictly shorter than t, and if t is strictly shorter than w. if these conditions hold your code should print (the boolean value) true. if not, your code should print false. (strictly means: no ties) example: if s, t, and w are "cat", "hats", and "skies" your code should print true - their lengths are 3-4-5; but if s, t, and w are "cats" "shirt", and "trust", then print false - their lengths are 4-5-5 enter your code in the box below
Answers: 2
question
Computers and Technology, 23.06.2019 06:00
Which statement is true of web-based social media? a.they allow consumers to interact with and update content. b.they cannot be updated easily, as compared to print media. c.they are expensive to produce and maintain, as compared to print and television. d.they can exist independent of the internet.
Answers: 1
You know the right answer?
This question involves a class named filetext that represents a text file.
public class filete...
Questions
question
Mathematics, 24.01.2020 02:31
question
Social Studies, 24.01.2020 02:31
Questions on the website: 13722363