Everybody loves when someone else can do a physics problem for them.
That's why we've been hard at work creating a program that incorporates
every single physics equation, complete with the ability to solve for
any variable. Through the use of many conditional statements, switches,
and what will be hundreds of line of code, we hope to bring forth
something that can help you finish your physics homework in 60 seconds
or less!
This just might be our final product down the line, but we are not sure
at this point if such a feat is possible. However, that's exactly what
we set out to do, create something we never thought we could do.
Thursday, March 31, 2016
Monday, March 28, 2016
Classes
Classes are the basis for object oriented programming. This week we learne
d how to create classes and objects to improve our code. The class is like a blueprint, it describes the object and how it will function. The object is the actual interpretation of the class. Objects can come from the same class, but have different features. This is like how a builder can make houses with the same blueprints but they can have different colored doors and slightly different layouts. Methods define the behavior of the class. Methods can be thought of as verbs while the object is the noun that does the action. Methods and variables in classes can be defined as public or private. Public variables and methods can be accessed from anywhere while private methods can only be accessed from within the class. Creating private methods allow the programmer to restrict access to certain features of their code which can help to stop bugs.
d how to create classes and objects to improve our code. The class is like a blueprint, it describes the object and how it will function. The object is the actual interpretation of the class. Objects can come from the same class, but have different features. This is like how a builder can make houses with the same blueprints but they can have different colored doors and slightly different layouts. Methods define the behavior of the class. Methods can be thought of as verbs while the object is the noun that does the action. Methods and variables in classes can be defined as public or private. Public variables and methods can be accessed from anywhere while private methods can only be accessed from within the class. Creating private methods allow the programmer to restrict access to certain features of their code which can help to stop bugs.
Monday, March 14, 2016
Encapsulation
This week, we finally learned how to keep the NSA's prying eyes from our precious program data, with the use of the Encapsulation method. This coding technique virtually "encapsulates" the data you choose, as to prevent other parts of a program, or even the outside world, from accessing and changing the data.
This can be useful for keeping certain data types constant, while allowing certain subsets within it to be changed. The same can be done with "viewing rights," as you can designate which class and objects can be seen or not seen by the public. In the example below, the data class "myAccount" is visible to the public, as well as the account # associated with it. If set to "private" instead, only the class will be visible, not the #. This has many real world applications, especially in the financial industry.
Monday, March 7, 2016
Functions and Loops
This week we learned about the creations of functions and loops. A function is a piece of code that performs a certain task. The function can be called several times throughout the program without having to rewrite the code each time. This makes coding faster and easier. Functions can be defined to take in values or use predefined values. A function has a certain return type that must be returned at the end of the function. Functions can be defined for several different uses such as computing an average or printing out a message. The use of functions will be very important in our final project. Loops are used to repeat the same few lines of code several times in a row. There are two main types of loops, the while loop and the for loop. The while loop is less rigid than the for loop. In a while loop, a statement is made that is either true or false. The code inside the loop keeps being repeated until the statement is false. This type of loop allows the programmer to change how many times the loop runs based on input from the user. In a for loop the number of times the code will run is more defined. The programmer must choose a variable, a statement, and a way to change the variable. The variable is changed in the same way every time the code runs. This allows for less change in the way the loop will run. The picture shows a for loop that is used to print out the phrase four times in a row.
Subscribe to:
Comments (Atom)




