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
Um i'm new here... and i don't know really how to use this... i was wondering if som 1 can help me
blagie [28]

Shining and warm

Collapse 3

JOJO

fate series

Bungou Stray Dog

EVA

Dao Master

Alien invasion

Future diary

Fate of Space

Story Series

Beyond the Boundary

Bayonetta

Onmyoji

Full-time master

How to develop a passerby heroine

Illusion Front

Psychometer

your name

Noragami

One Piece

Senran Kagura

Attacking Giant

Kabaneri of the Iron Fortress

Violet Evergarden

Demon Slayer

Under one person

Guilt crown

Black reef

Star Cowboy

Black Street Duo

Aria the Scarlet Ammo

Hatsune Miku

The last summoner

re creator

Detective Conan

Naruto

grim Reaper

Tokyo Ghoul

Song of Hell

At the beginning

Sword Art Online

Girl opera

Hakata pork bones pulled dough

Sunny

Black bullet

Trembling

On the broken projectile

Black Butler

Destiny's Gate

Persona

God Prison Tower

April is your lie

Ground-bound boy Hanako-kun

League of legends

Clever girl will not get hurt

Tomorrow's Ark

DARLING in the FRANKXX

RWBY

Little Busters

dating competition

Gintama

One Punch Man

The promised neverland

Taboo curse

God of college

Queen of Arms

Sword Net 3

Final fantasy

6 0
3 years ago
Read 2 more answers
Why is Apple using social media ?
jeka57 [31]

Apple uses social media to promote their products and increase user-engagement. This is a very effective method of advertising.

6 0
3 years ago
Why was the microchip essential to improving computers?
-BARSIC- [3]
Because it downsized the scale of the computer itself.

5 0
3 years ago
Implement the simulation of a biased 6-sided die which takes the values 1,2,3,4,5,6 with probabilities 1/8,1/12,1/8,1/12,1/12,1/
hjlf

Answer:

see explaination

Explanation:

import numpy as np

import matplotlib.pyplot as plt

a = [1, 2, 3, 4, 5, 6]

prob = [1.0/8.0, 1.0/12.0, 1.0/8.0, 1.0/12.0, 1.0/12.0, 1.0/2.0]

smls = 1000000

rolls = list(np.random.choice(a, smls, p=prob))

counts = [rolls.count(i) for i in a]

prob_exper = [float(counts[i])/1000000.0 for i in range(6)]

print("\nProbabilities from experiment : \n\n", prob_exper, end = "\n\n")

plt.hist(rolls)

plt.title("Histogram with counts")

plt.show()

check attachment output and histogram

4 0
3 years ago
11 of the 25 people on the bus get off at the first stop. What percent best represents the portion of the bus that got off on th
miskamm [114]

Answer:

44%

Explanation: First, you have to divided 11 by 25. Which is 0.44. And then you multiply the quotient by 100 to get your percentage.

5 0
3 years ago
Other questions:
  • Which disk drive type contains a magnetic HDD with onboard flash memory serving as a non-volatile cache?
    6·1 answer
  • What does pagination mean in Microsoft Word?
    10·2 answers
  • To secure the company website, the webmaster suggests that the company purchase a secure certificate to encrypt all communicatio
    5·1 answer
  • Which part of project management involves determining the required materials?
    14·2 answers
  • Anyone wanna play Smash Ultimate. I'm a Link main (that doesn't mean I camp, thats young link) who plays competitve with legal s
    8·1 answer
  • Code embedded into an HTML page and downloaded by a user; resides on the client and helps process Web form input. Common clients
    9·1 answer
  • The Curtis Publishing Company's early marketing research efforts mainly had to do with _____. people who drove automobiles peopl
    10·1 answer
  • Overview In this assignment, you will gain more practice with designing a program. Specifically, you will create pseudocode for
    7·1 answer
  • Name 4 components of a components system​
    9·1 answer
  • A group of two or more computer systems linked together via communication devices is called:.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!