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
PIT_PIT [208]
3 years ago
13

Does anyone know how to write this right? This is for a coding class and I’m super confused on it.

Computers and Technology
1 answer:
vovangra [49]3 years ago
4 0

Answer:

This is using c++ syntax, you might need to make slight adjustment for other languages.

First activity:

string firstSnack = "chips";

string secondSnack = "pizza";

string thirdSnack = "apples";

string bestSnack =  firstSnack;

bestSnack = secondSnack;

Second activity:

double apple = 0.5;

double banana = 0.75;

double orange = 1.43;

double total = apple + banana + orange;

Explanation:

When first declaring a variable, you want to specify the type (such as int, double, string, bool, etc.) and then the name. You can set the variable value in the declaration, or you can set it to a value later in the program by not having the equals sign and whatever comes next.

You might be interested in
What does IP stand for (as in IP address)? Also, what is overtype mode?
tino4ka555 [31]
An  IP address is mostly for your WIFI . Internet Protocol . 

Overtype Mode is where you are making changes to text (putting in new characters) 
4 0
3 years ago
In the technology referred to as ____, a message is divided into several parcels that can be routed independently to their desti
gregori [183]
Your answer is packet switching, hope I could help
Have a great day :)
7 0
4 years ago
Who sends the Certificate, the client, the server, or both? A certificate is sent by one party to let the other party authentica
ohaa [14]

Answer: Both the server and the client send certificates

Explanation:

In a given network session the server sends a certificate to the client . The client is able to verify that the server's identity, the authentication uses a public encryption key and a digital signature .The client in turn retrieves a private key they can use to create a digital signature . A certificate is then sent by the client across the network to the server and it uses it to authenticate the client's identity . Once the server has confirmed that the client is who they say they are it grants access for the verified identification.

3 0
3 years ago
C++You are given an array x of int elements along with an int variable n that contains the number of elements in the array . The
Firdavs [7]

Answer:

C++ Code

#include <iostream>

using namespace std;

int median(int x[], int n)

{

   for (int i = 0; i < n-1; i++)

   {

   for (int j = 0; j < n-i-1; j++)  

       if (x[j] > x[j+1])

       {

           int temp = x[j];

           x[j] = x[j+1];

           x[j+1] = temp;

       }

   }

   if( n%2 == 0 )

   {

       return (x[ (n/2) -1] + x[n/2])/2;

   }

   else

   return x[n/2];

}

int main()

{

   //example 1

   int x[] = {5,8,1,7,9};

   int n = 5;

   

   int m = 0;

   m = median(x,n);

   cout << m << endl;

   

   //example 2

   int x2[] = {3,7,1,4,6,9};

   int n2 = 6;

   m = median(x2,n2);

   cout << m << endl;

}

Explanation:

The main program contains the examples given in the question.

Function Explanation: The function int median(int x[], int n) takes two arguments, one is the array x and the other is the size of the array n.

First, the function sorts the elements in ascending order.

After that, it is calculated whether n is even or odd. If n is an even number,  The middle numbers can be obtained as follows:

Divide n by 2 to get the first middle element.

The second middle element is the element before first middle element, therefore

x[ (n/2 )-1] + x[n/2] gives us the sum of middle elements, where as dividing it by 2 gives us the avg of the two numbers.

If n is an odd number, than the middle element can be simply returned by dividing n by 2.

The working of the program is as follows

Array 1: 5 8 1 9 7

After sorting, it becomes: 1,5,7,8,9.

Array indices are : 0,1,2,3,4. Middle element is at index 2, n = 5, therefore n/2 = 2.5 (This is rounded down to 2 because result is stored in integer)

Array 2: 3 7 1 4 6 9

After sorting, it becomes: 1 3 4 6 7 9

Array indices are : 0,1,2,3,4,5. Middle element is at index 2 and 3,n = 6, therefore it can be obtained by n/2-1 and n/2 (n/2 = 3 and n/2 - 1 = 2)

3 0
3 years ago
Suppose you roll a fair, six-sided die 100 times and then make a histogram of your results. Which of the following would most li
Step2247 [10]

Answer:

Option D is correct.

The characteristic distribution obtained would be uniform.

Explanation:

A fair die is a type of die where all the faces have equal chances of showing up. So, theoretically, if a fair die is thrown a certain number of times (n), the number of times each face/number would show is n/6 or amazingly close to that; which in turn is a uniform distribution where the data is spread out evenly. Each column of the histogram will have almost equal heights.

A skew distribution will have most of the data points clustering around either the far left or far right of the distribution.

A symmetric distribution with a central peak indicates that the data spreads out from the far right with increasing frequency up till the middle of the distribution, which has the highest frequency, then the data starts reducing in frequency as we move away from this central peak towards the far right of the distribution.

Those are clearly not the type of distribution to theoretically expect from a fair die.

6 0
3 years ago
Other questions:
  • Universal Windows Platform is designed for which Windows 10 version?
    7·1 answer
  • If a simple pipelined processor is super-pipelined by a factor of 3 (the ALU takes 3 cycles instead of one for the smallest oper
    15·1 answer
  • What kind of digital certificate is typically used to ensure the authenticity of a web server to a client?
    7·1 answer
  • Write a C++ program that overloads a function named LinearSearch that searches an array of data of either integer data type, flo
    8·1 answer
  • Larry finds it easy to run legacy programs and applications in a virtualized environment. how does the virtualization provider m
    7·2 answers
  • Write a python program to print the square of all numbers from 0 to 10.
    15·1 answer
  • Represent the measuring unit ofcomputer un terms of fration of second​
    13·1 answer
  • Realizar una lista de las herramientas manuales que se utilizan en carpintería y otra en herrería, dibuja cada una de ellas y ex
    13·1 answer
  • Write a code segment that will store a dinner selection in option1 based on the values of rsvp and selection. The intended behav
    5·1 answer
  • Selecting the Tiled windows arrangement option places the windows in a(n) _______ pattern on the screen.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!