subject

Alright, ladies and gentlemen, this computer science review question has me stumped. the directions are as follows:

this question involves a class named textfile that represents a text file.
public class textfile
{
private string filename;
private arraylist words;
// constructors not shown

// postcondition: returns the number of bytes in this file
public int filesize()
{
}
// precondition: 0 < = index < words. size()
// postcondition: removes numwords words from the words arraylist beginning at
// index.
public void deletewords(int index, int numwords)
{
}
// precondition: 0 < = index < = words. size()
// postcondition: adds elements from newwords array to words arraylist beginning
// at index.
pub lic voidaddwords(int index, string[] newwords)
{
}
// other methods not shown
}
complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte.

for example, suppose the words arraylist stores the following words:
{ mary had a little lamb; its fleece was white as snow. }
the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words.
complete the filesize() method below:
// postcondition: returns the number of bytes in this file
public int filesize()
{

}

after looking over the instructions, i'm practically brainless in regards to where i'm supposed to go from here. i need to return the results of the filesize method and i have no idea how to do it. if anyone could me out, it'd be greatly appreciated!

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 22.06.2019 15:00
The three logical operators used to write compound conditions are "and," "or," and "not." a: true b: false
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
Alexโ€™s family members live in different parts of the world. they would like to discuss the wedding plans of one of their distant relatives. however, alex wants all the family members to talk to each other simultaneously so that they can make decisions quickly. which mode of internet communication should they use? a. blog b. email c. wiki d. message board e. instant messaging
Answers: 2
question
Computers and Technology, 24.06.2019 23:30
Does anyone have the problem where you try to watch a video to get your answer but it brings up a thing asking your gender to make ads relevant but it doesn't load? btw i won't be able to see the answer so use the comments .
Answers: 1
You know the right answer?
Alright, ladies and gentlemen, this computer science review question has me stumped. the directions...
Questions
question
Mathematics, 29.03.2021 16:40
question
Mathematics, 29.03.2021 16:40
Questions on the website: 13722362