J
J
JuliaCS2019-10-04 00:35:17
Java
JuliaCS, 2019-10-04 00:35:17

How to come up with the names of variables and specify the type of variables?

Help the student!) We were given the
task to come up with the names of the variables and indicate the type of variables . How to write it correctly?
Here's an example:
The speed of the car and the Number of ships in the port
are already racking my brains on how to write it correctly :(((
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Narryel, 2019-10-04
@narryel

the name depends on where it will be used, if the speed is a field of an object of type Car, then just int speed, otherwise int carSpeed/carVelocity
is the same with the second one (shipsCount).
The main thing is that with all subsequent readings of the name of this variable, you have the same association about what is stored in this variable. If it seems that the name is chosen incorrectly, it doesn’t seem that it is necessary to rename

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question