Answers

Answer 1
Answer:

Answer:

I can't give an answer if you don't tell me what you need help with

Explanation:

I can't give an answer if you don't tell me what you need help with


Related Questions

In ____________, a large address block could be divided into several contiguous groups and each group be assigned to smaller networks.
9 Which of these words is used to begin a conditional statement? ​
How to solve the problem in the man middle attack?
What error can you identify? (Points : 4)A double quotation mark was incorrectly inserted.You cannot compare apples to oranges.Assumes indentation has a logical purposeNo error
Perform depth-first search on each of the following graphs; whenever there's a choice of vertices, pick the one that is alphabetically first. Classify each edge as a tree edge, forward edge, back edge, or cross edge, and give the pre and post number of each vertex.

Translate each statement into a logical expression. Then negate the expression by adding a negation operation to the beginning of the expression. Apply De Morgan's law until each negation operation applies directly to a predicate and then translate the logical expression back into English.Sample question: Some patient was given the placebo and the medication.
∃x (P(x) ∧ D(x))
Negation: ¬∃x (P(x) ∧ D(x))
Applying De Morgan's law: ∀x (¬P(x) ∨ ¬D(x))
English: Every patient was either not given the placebo or not given the medication (or both).
(a) Every patient was given the medication.
(b) Every patient was given the medication or the placebo or both.
(c) There is a patient who took the medication and had migraines.
(d) Every patient who took the placebo had migraines. (Hint: you will need to apply the conditional identity, p → q ≡ ¬p ∨ q.)

Answers

Answer:

P(x): x was given the placebo

D(x): x was given the medication

M(x): x had migraines

Explanation:

(a) Every patient was given the medication

Solution:

∀x D(x)

∀ represents for all and here it represents Every patient. D(x) represents x was given the medication.

Negation:¬∀x D(x).

This is the negation of Every patient was given the medication.

The basic formula for De- Morgan's Law in predicate logic is:

¬(P∨Q)⇔(¬P∧¬Q)

¬(P∧Q)⇔(¬P∨¬Q)

Applying De Morgan's Law:

          ∃x ¬D(x)

represents there exists some. As D(x) represents x was given the medication so negation of D(x) which is ¬D(x) shows x was not given medication. So there exists some patient who was not given the medication.

Logical expression back into English:

There was a patient who was not given the medication.

(b) Every patient was given the medication or the placebo or both.

Solution:

∀x (D(x) ∨ P(x))

∀ represents for all and here it represents Every patient. D(x) represents x was given the medication. P(x) represents  x was given the placebo. V represents Or which shows that every patient was given medication or placebo or both.

Negation: ¬∀x (D(x) ∨ P(x))

This is the negation or false statement of Every patient was given the medication or the placebo or both.

Applying De Morgan's Law:

∃x (¬D(x) ∧ ¬P(x))

represents there exists some. As D(x) represents x was given the medication so negation of D(x) which is ¬D(x) shows x was not given medication. As P(x) represents x was given the placebo so negation of P(x) which is ¬P(x) shows x was not given placebo. So there exists some patient who was neither given medication nor placebo.

Logical expression back into English:

There was a patient who was neither given the medication nor the placebo.

(c) There is a patient who took the medication and had migraines.

Solution:

∃x (D(x) ∧ M(x))

represents there exists some. D(x) represents x was given the medication. M(x) represents x had migraines.  represents and which means patient took medication AND had migraines. So the above logical expression means there exists a patient who took medication and had migraines..

Negation:

¬∃x (D(x) ∧ M(x))

This is the negation or false part of the above logical expression: There is a patient who took the medication and had migraines.

Applying De Morgan's Laws:

∀x (¬D(x) ∨ ¬M(x))

represents for all. As D(x) represents x was given the medication so negation of D(x) which is ¬D(x) shows x was not given medication. As M(x) represents x had migraines so negation of ¬M(x) shows x did not have migraines. represents that patient was not given medication or had migraines or both.

Logical expression back into English:

Every patient was not given the medication or did not have migraines or both.

(d) Every patient who took the placebo had migraines.

Solution:

∀x (P(x) → M(x))

∀ means for all. P(x) represents  x was given the placebo. M(x) represents x had migraines. So the above logical expressions represents that every patient who took the placebo had migraines.

Here we are using conditional identity which is defined as follows:

Conditional identity, p → q ≡ ¬p ∨ q.

Negation:

¬∀x (P(x) → M(x))

¬∀ means not all. P(x) implies M(x). The above expression is the negation of Every patient who took the placebo had migraines. So this negation means that Not every patient who took placebo had migraines.

Applying De Morgan's Law:

∃x (P(x) ∧ ¬M(x))

represents there exists some.  P(x) represents  x was given the placebo. ¬M(x) represents x did not have migraines. So there exists a patient who was given placebo and that patient did not have migraine.

Logical expression back into English:

There is a patient who was given the placebo and did not have migraines.

Implement a java program to find the smallest distance between two neighbouring numbers in an array.

Answers

Answer:

Here is the JAVA program to find smallest distance between 2 neighboring numbers in an array.

import java.lang.Math; // for importing Math class functions

import java.util.Scanner; // for importing Scanner class

public class CalSmallestDistance // class to calculate smallest distance

{public static void main(String[] args) {     // to enter java program

    Scanner s = new Scanner(System.in);  //creating scanner object

    int size; // size of the array

  System.out.print("Enter size of the array:"); //prompts to enter array size

       size = s.nextInt(); // reads input

       int arr[] = new int[size];  // array named arr[]

      //line below prompts to enter elements in the array             System.out.println("Enter numbers in the array:");

       for(int j = 0; j < size; j++)        //loops through the array

           {arr[j] = s.nextInt(); }     //reads the input elements

      int smallest_distance = Math.abs(arr[0]-arr[1]);  

       int position= 0; //index of the array

       for(int i=1; i<arr.length-1; i++){

           int distance= Math.abs(arr[i]-arr[i+1]);

           if(distance< smallest_distance){

           smallest_distance= distance;

           position = i;            }        }

  System.out.println("Smallest distance is :"+smallest_distance);

System.out.println("The numbers are  :"+arr[position]+ " and " +arr[position+1]);      } }

Explanation:

I have stated the minor explanation of some basic lines of code as comments in the code given above.

Now i will give the detailed explanation about the working of the main part of the code.

Lets start from here

      int smallest_distance = Math.abs(arr[0]-arr[1]);  

In this statement the array element at 0 index (1st position) and the array element at 1 index (2nd position) of the array are subtracted.

Then i used the math.abs() method here  which gives absolute value

Lets say the distance between 3 and 5 is -2 as 3-5 equals to -2. But the math.abs() method will return 2 instead of -2.

Now the subtraction of two array elements and absolute value (if subtraction result is negative) will be assigned to variable smallest_distance.

       for(int i=1; i<arr.length-1; i++)

This is for loop. Variable i is positioned to the 1 index of the array (arr) (it is pointing to the second element of the array). It will move through the array until the end of the array is reached i.e. the loop will continue till value of i remains less than the length of the array.

Now at the start of the loop body the following statement is encountered

           int distance= Math.abs(arr[i]-arr[i+1]);

This subtracts the array element at i th position and array element at i th +1 position (means one position ahead of array element at i th position). In simple words two neighboring numbers in an array are being subtracted and Math.abs() method is used to give absolute value. The result of this operation is assigned to distance variable.

           if(distance< smallest_distance)

This if statement checks if the value in distance variable is smallest than the value of smallest_distance variable which was previously calculated before calculating the value for distance variable.

If this condition is true then the following statements are executed:

             smallest_distance= distance;

if distance value is less than value in smallest_distance, then the value of distance is assigned to smallest_distance.

this means the smallest_distance will keep on storing the smallest distance between two neighboring numbers.

Next the value of variable i that is pointing to the 1st index of the array is now assigned to the position variable.

                                         position = i;

It will keep assigning the value of i to position variable so at the end of the program we can get the positions of the two neighboring numbers that have the smallest distance between them.

Then the value of i is incremented and moves one place ahead in the array.

Then the 2nd iteration takes place and again checks if i pointer variable has reached the end of the array. If not the loop body will continue to execute in which the distance between the two neighboring numbers is calculated and shortest distance is stored in smallest_distance.

When i reaches the end of the array the loop will break and the smallest distance between two neighboring numbers in the array have been stored in the smallest_distance variable.

Finally the statement System.out.println("Smallest distance is :"+smallest_distance); displays the shortest distance and the statement System.out.println("The numbers are  :"+arr[position]+ " and " +arr[position+1]); displays the array index positions at which the two neighboring numbers have the smallest distance.

Which statement is written correctly?

Answers

Answer:

B.

Explanation:

In Javascript, the if should have a condition attached to it with parenthesis and curly braces.

Write a program that prints the following 45 pairs of numbers:11
21
22
31
32
33
41
42
43
44
51
***
97
98
99
Note that the first numbers go from 1 to 9, and the second numbers start at 1 and go up to the
value of the first number (9 times). You must use loops to do this not 45 print statements.

Answers

Answer:

  • Code is in JAVA language. As there is no user input the logic is straightforward.
  • Below is the code along with a detailed explanation of the logic.
  • The class name is Print main save as file as the main class.

Explanation:

Program:-

public class Main{

public static void main(String args[]){

/* There are two for loops...

* First for loop runs from i=1 to i=9

* Second for loop runs from j=1 to j=i.

*

*/

for(int i=1;i<=9;i++){

for(int j=1;j<=i;j++){ // j loop runs from j=1 to j=i

/*Prints I and j next to each other*/

System.out.println(i+""+j);

}//for loop of j ends here

}// for loop of I ends here

}

}

Give the one simple program using c++programming language​

Answers

Answer:

the ejedjrjr eenekrr

eueeue

Explanation:

u4rururirw

Numbers are calculated in Excel using formulas and ______.

Answers

To calculate percent of a total (i.e. calculate a percent distribution), you can use a formula that simply divides an amount by the total.

Note: you must format the result using the Percentage number format in Excel to see 25%, 10%, etc. 



 the reference to C11 is absolute (i.e. $C$11) so that it won't change when the formula is copied down the column.

As always in Excel, when you want to display a percentage, you need to use the Percentage number format, which will automatically display a decimal value as a percentage.



-dave bruns

Answer:

equations

this is the answer