Tuesday, April 15, 2014

Accessing member variables in another class

both a class AND its member variables have to be declared public to be referenced by other classes.

Changing Member Variable Values

To change the value of a member variable from a static class method, the member variable must first be declared as static itself.

Stupid mistakes

One of the things that are kind of dumb which i did in this project is I forgot the first line of code in the whole project.

public classes and objects

If you have a class with a certain name x, and you want to have that class create an object y with different attributes from class x, you can create a public class y in the same project with constructors for a y object.
Since I forgot the member variables, and didn't declare them I was stumped for a while and confused as why it wouldn't work. I have truly learned from this and will remember to do it next time. Other syntax errors also messed up the code, such as spelling name as namr, and street as strt.

New Libraries

The new library that we have to work with is called number format. What the "currency" instance of this class does is it makes the number that is inputted look nicer by putting a dollar sign in front and rounding to two decimal places.