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
Maru [420]
2 years ago
13

Why would a programmer use a “public” variable for something like speed? Provide at least two other examples of variables a deve

loper would likely make “public.”
Computers and Technology
1 answer:
agasfer [191]2 years ago
7 0

It is useful for things that you don't need to redefine, and you may need to use to compute different things (such that you have different modules/functions to compute each one of these things).

<h3><u>What is a public variable?</u></h3>

A public variable is a variable that any function, sub procedure, or module can access without restriction.

Thus, if you want to define a variable only once and be able to call it from different functions or modules when you need it, you would want to make it a public variable.

An example with speed is:

You can make a simple code that for an initial speed computes the position vs time graph.

But you may want to expand that program, let's say that you make a module that also allows you to find the momentum or something like that (where you also need to use the speed).

Then defining the speed as public, is useful, as you can only call it with the module or function that you use to find the momentum.

Another example, maybe more complete.

Assume that you work with radiation physics. You define a mean energy of radiation (this would be the energy of the x-rays for example).

Now if you define that variable as public, you could use it for a lot of modules to compute a lot of different things, like fluency, kermas, etc.

Things that are really complex to compute and you may have the codes for each one in different modules/functions.

So it is really useful when you already had several codes that work with the same variable.

If you want to learn more about variables, you can read:

brainly.com/question/15683939

You might be interested in
In a linked chain implementation of a queue, the performance of the enqueue operation
alexdok [17]

Answer:

A.O(1)

Explanation:

In the implementation of queue by using linked chain the performance of  the enqueue operation is O(1).We have to  maintain  two pointers one  head and the other tailand  for  enqueue operation  we have to insert element  to the next of the tail and then  make that element  tail.Which takes O(1) time.

4 0
3 years ago
All the processing-of work-done on a computer is performed by the what?
Nat2105 [25]
It's computed by the processor
6 0
3 years ago
Why is democracy the best form of government
julia-pushkina [17]

Democracy is the best form of government simply because no other form of government is known to work well. Democracy may have its flaws but all in all it .

3 0
3 years ago
A programmer writes a for statement to count from 1 to 10 and explicitly mentions the 1 and the 10 in the for “header.” which re
o-na [289]
The relational operator used would probably be <=
6 0
3 years ago
Your boss wants you to configure his laptop so that he can access the company network when he is on the road. You suggest a VPN
Rashid [163]

Answer:

All traffic that flows between the laptop and VPN server is encrypted.

Explanation:

A Virtual Private Network (VPN) is a "tunnel" connection between computers that performs just like a regular point-to-point network connection (that is, IP address to IP address).  It has the added feature that encryption is enabled so that no intermediate server (or computer or line monitor, etc.) can decode the information that is in the data portion of the packets.

5 0
3 years ago
Other questions:
  • Ashley wants to know the oldest form of both water purification and waste disposal. Help Ashley determine the methods. The oldes
    14·1 answer
  • Write a program that will askthe user to enter the amount of a purchase. The program should thencompute the state and county sal
    5·1 answer
  • Consider this data sequence: "fish bird reptile reptile bird bird bird mammal fish". let's define a singleton to be a data eleme
    5·1 answer
  • How many answer or point do I answer/need to sent message?
    6·1 answer
  • Rerouting traffic using arp poisoning is an attack on ________ of a network.
    8·1 answer
  • 6.An organization wants to implement a remote dial-in server to ensure that personnel can connect to the organization's network
    11·1 answer
  • JAVA
    12·1 answer
  • When you listen to a guitar duet and have trouble hearing the melody, which of the following would best explain the problem?
    14·2 answers
  • What is a sensitive compartmented information program
    12·1 answer
  • Spreadsheets are sometimes credited with legitimizing the personal computer as a business tool. Why do you think they had such a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!