1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svp [43]
3 years ago
14

Unit 6: Lesson 2 - Coding Activity 1 AP Computer science

Computers and Technology
1 answer:
sladkih [1.3K]3 years ago
8 0

The complete program is to define a boolean method that returns true if all elements of an array are negative, or return false, if otherwise

The method in java, where comments are used to explain each line is as follows:

//This defines the method

public static boolean chkNegative (double[] myArr) {

   //This initializes a boolean variable

   boolean isNeg = true;

   //This iterates through the array

   for (int i = 0; i < myArr.length; i++) {

     //If the array element is 0 or positive

     if (myArr[i] >= 0) {

         //Then the boolean variable is set to false

       isNeg = false;

       //And the loop is exited

       break;

     }

   }

   //This returns true or false

   return isNeg;

 }

Read more about boolean methods at:

brainly.com/question/18318709

You might be interested in
In a bubble sort, you use a(n) ____ loop to make pair comparisons.
GarryVolchara [31]
In a bubble sort, you use an inner loop to make pair comparisons.
5 0
3 years ago
To resolve a domain name on the internet, the dns resolver first contacts:
777dan777 [17]
If it can't find the answer in it's own cache, it will contact one of the name servers that it was configured to use.
8 0
3 years ago
What sort of technique would you use to sort 10,000 items using just 1000 available slot in your RAM?
beks73 [17]

Answer:

d. Merge sort

Explanation:

Merge sort is example of an efficient sorting alogrithm. The Divide and conquer rule is used in this technique. This method breakdown the list into multiple sublists and each sublist contains a single element. This technique merged in the form of sorted lists. This technique uses external memory of the system while sorting.

Merge sort is used to sort the 10,000 items using only 1,000 slots available in the RAM.

5 0
3 years ago
We assume that ABC Corporation has two business offices. These offices are in the cities of Orlando and Miami. These cities are
murzikaleks [220]

Answer:

The following are the answer to the given points:

Explanation:

In point (a):

Calculating the long-distance call cost:

= 4 \times 5 \times 0.40 \\= 20 \times 0.40\\= 8

Calculating the local call cost:

= 10 \times 3  \times 0.05\\ = 30 \times 0.05\\= 1.5

Calculating the overall cost of PSTN:

= 25 + (4 \times 5 \times 0.40) + (10 \times 3 \times 0.05) + 2000 + 275 \\= 25 + 8 + 1.5 + 2000 + 275 \\=   2309.5

In point (b):

Calculating the call rate per second and the average arrival rate:

\to (\lambda) = 0.2

The call average length:

\to (T_s) = - 8  \\\\ = (8  \times 60) \ seconds \\\\ = 480 \ seconds  

The complete agent number:

\to  (m) = 9

The strength of traffic:

\to u = \lambda \times  T_s  \\\\  =   (0.2  \times 480) \\\\ = 96    

The occupancy of the agent:

\to  p = \frac{u}{m}  \\\\

      = \frac{96}{9}  \\ \\= 10.66  

Calculation of obtained:

= \frac{(\frac{um}{m!})}{(\frac{um}{m!})} + (1-p) \sum {m-1} _{k=0}  \ \frac{uk}{k!}

We get = 0.329 to substitute values.  

In point (c):

The rate of blocking = 5 \%

average call time (T_s) = 480 \ seconds

                                    = 0.05 \times  480 \ seconds \\  = 24 \ second

In point (d):

Calculating the number of link, which is required:  

= \frac{275}{5} \\\\ =55

In point (e):

Calculating the Line Number:

= \frac{275}{5} \\\\ =55

PSTN line number:

=  (\frac{2000}{55}) \\\\ = 36.3636\\\\= 37

In point (f):

The gross design expense = $ 2309. 5

5 0
4 years ago
What is the output, if userVal is 5? int x; x = 100; if (userVal != 0) { int tmpVal; tmpVal = x / userVal; System.out.print(tmpV
spayn [35]

Answer:

The output is 20

Explanation:

This line divides the value of x by userVal

tmpVal = x / userVal;

i.e.

tmpVal = 100/5

tmpVal = 20

This line then prints the value of tmpVal

System.out.print(tmpVal);

i.e 20

Hence, The output is 20

4 0
3 years ago
Other questions:
  • What is the difference between a router and a modem
    15·1 answer
  • Where are all of your documents saved?
    14·2 answers
  • ____ is an act, directed at Web sites catering to children, that requires site owners to post comprehensive privacy policies and
    5·1 answer
  • Write a complete program that declares an integer variable, reads a value from the keyboard into that variable, and writes to st
    11·1 answer
  • A _____ is a control that tells the computer what task to perform.
    6·1 answer
  • While these two approaches have similarities in terms of the topics they address, ________ will cover broad IT management topics
    7·1 answer
  • GUYS PLEASEEEE HELP !!!
    12·2 answers
  • What is a statement that runs only under counting conditions?
    11·1 answer
  • Determine what is printed by the following code.
    8·1 answer
  • Can someone help me explain Nvm scheduling in operating systems?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!