Answer:
Explanation:
The following program was written in Java. It creates a loop that asks the user for numbers. If it can convert it to an integer it accepts it and adds it to the sum variable otherwise it ouputs that it is not a valid number. Once all 10 integers are added it prints the Average of the values entered.
import java.util.ArrayList;
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count = 0;
int sum = 0;
while (count != 10) {
System.out.println("Enter a number: ");
String answer = in.nextLine();
try {
int intAnswer = Integer.parseInt(answer);
sum += intAnswer;
count += 1;
} catch (NumberFormatException e) {
System.out.println("Not a valid number.");
}
}
int average = sum / count;
System.out.println("Average: " + average);
}
}
Answer:
Destructor:-To free the resources when lifetime of an object ends.
Accessor:-To access private properties of the class.
Explanation:
The purpose of a destructor is to free the resources of the object that it has acquired during it's lifetime. A destructor is called once in the lifetime of the object that is also when the ifetime of the object ends.
The purpose of the accessors is to access private properties of the class.Accessor cannot change the value of the private members.They are also called getters.
Answer:
in this case is table of contents
Explanation:
If Melanie want to organize the content, she can use index or table of content, but for specific sections table of content is easier to use.
For example:
Melanie can organize the titles in different levels like subtitle at the same page.
1 History..................................1
1.2 USA History....................1
1.3 California History..........1
Melanie have to mark every title and subtitle in the document like "History -title 1", "USA History - title 2", "California History - title 3".
Melanie can create the table on content automatically in Word: at the section -> Reference -> table of content.
Readers can locate every important section by page, title and subtitle.