Answer:
Explanation:
The following is written in Java. It continues asking the user for inputs until they enter a -1. Then it saves all the values into an array and calculates the number of values entered, the highest, and lowest, and prints all the variables to the screen. The code was tested and the output can be seen in the attached image below.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count = 0;
int highest, lowest;
ArrayList<Integer> myArr = new ArrayList<>();
while (true) {
System.out.println("Enter a number [0-10] or -1 to exit");
int num = in.nextInt();
if (num != -1) {
if ((num >= 0) && (num <= 10)) {
count+= 1;
myArr.add(num);
} else {
System.out.println("Wrong Value");
}
} else {
break;
}
}
if (myArr.size() > 3) {
highest = myArr.get(0);
lowest = myArr.get(0);
for (int x: myArr) {
if (x > highest) {
highest = x;
}
if (x < lowest) {
lowest = x;
}
}
System.out.println("Number of Elements: " + count);
System.out.println("Highest: " + highest);
System.out.println("Lowest : " + lowest);
} else {
System.out.println("Number of Elements: " + count);
System.out.println("No Highest or Lowest Elements");
}
}
}
Answer:
A. The parent-teacher orginization keeps a log of cookies sales to raise money for the elementary school.
Explanation:
Answer:
a. Protected
b. Public
Explanation:
There are four acess modifier in Java.
Default: Acessible only within the same package.
Public: Can be acessed by any class.
Private: Acessible only within the class.
For example, you have a class employee and a private method. This method can only be accessed by an object that is an instance of an employee.
Protected: Used in classes that extend each other. For example, a class of employees would extend employee.
So:
a. A class Employee records the name, address, salary, and phone number.
The best acesses modifier is protected. A class may extended employee but have the same arguments(name, adress, salary, phone number), so it should also have acess to the method.
b. An adding method inside of a class BasicMath.
This method can be used in a variety of packages and projects and classes... and there is no important information regarding security. So the best method is public.
I’m sorry I do not speak that
Well the nonchalant question given for 4th grade red named babyface Justin and Jerome