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.
Answer:
Each variable is named so it is clear which variable is being used at any time. It is important to use meaningful names for variables: ... The name given to each variable is up to the programmer, but ideally a variable name should have meaning, ie it should reflect the value that it is holding.
Variables make code more than a static set of instructions. They allow logic to occur, enabling developers to measure time, analyze data, and customize the program to the user. Variables are so important to the code that they deserve a good name that accurately describes their purpose
Explanation: