# APCS Recursive Factorial Function

### How it works

Code:

```public static int factorial(int n){
//stop
if (n == 1){
return(1);
}
//recursion
return(num * factorial(n-1));
}```

Basically, by calling factorial (n), you will call factorial (n-1) until n == 1, in which it will return 1. This leads to a chain of n*n-1*n-2 etc etc etc until we hit the stop.

# APCS – Cipher Project

### What Cipher Am I Doing

I’m making the columnar cipher. In short what this does it it will take a string, convert the string into a x*y size grid, shuffle it somehow, and then convert the new grid back into a string, and then return that. To shuffle my grid I reversed it, however there are a multitude of other methods on how to accomplish this.

### Imports

ArrayList:

ArrayList is an alternative array structure to the standard java array. I like it more and it works well with my programs

List:

I used this as a supplement to create my columns. Can be seen when I created the list of lists of characters.

PrintWriter:

Its a better printer. You can print arrays and see all their indexes and it just makes debugging easier.

Collections:

I used collections to reverse my arraylist. You can also use it to sort and shuffle arraylists which I used in elevens lab.

Misc swing imports:

Used to make my GUI.

### Use of loops

For this project I used for loops entirely, although while loops would have also been a feasible, although convoluted, method. Outside of the GUI I didn’t use a single while loop, as it would have complicated things more than they would’ve needed to be. I used for loops mainly to construct and deconstruct the grid-

```// puts the string into columns and fills the remainder with 'x'
int o = 0;
for (int i = 0; i < y; i++) {
for (int z = 0; z < x; z++, o++) {
if (o < s.length()) {
} else {

-more examples like this can be seen in my encrypt and decrypt classes, and for loops formed the backbone of keeping this cipher dynamic and functional.

### Conclusion

In conclusion this cipher was, for the most part, successful. It works as it should and my crude GUI serves its purpose. However I do think I could have made it a little more complicated than I did. Overall it was fun to code, and I’m excited to move onto harder challenges.

online

# APCS Blog Post August 22

#### Successes in this class:

I was able to create a dynamic variable area calculator that could accurately print the area for rectangles, triangles, and circles. This I think was a big step in grasping java, as I now know how to call methods and can set and use method parameters to create more intricate projects. In addition I think my ability to dynamically decide what shape and dimensions I wanted was a big accomplishment compared to a lot of others who I saw hardcoding their dimensions into their programs.

#### Different data types in java:

1. Boolean
1. Booleans are true or false values. They can either be true or false.
2. Integer
1. Integers are whole numbers.
3. Double
1. Double values are double-prescision 64 bit values. I’m not totally sure what that means but it is the standard when storing decimal values.
4. Float
1. Floats are single-precision 64 bit values. These are more lightweight however are not as precise as double, so they are more often used for mass, low priority, data storage.

# APCS Blog Post August 21

In class today I learned a few important things:

1. First I learned how to use the BlueJ IDE. I used it to create the two classes DiffPhrases and HelloWorld
2. Second I learned how to set up a main method and print using Java. I am more comfortable using python as I’ve used it for a lot longer however this HelloWorld class was a good start to learning Java.
3. Third and possibly the most importantly I learned the syntax for using a for loop in Java. I used this in my DiffPhrases function to print each argument passed when calling it. This loop can be seen below:
```public class DiffPhrases{
public static void main(String[] args){
for (int i=0; i < args.length; i++){
System.out.println(args[i]);
}
}
}```

# Python:

This bit wasn’t too challenging for me. I watched a short video on if else statements and was set to finish.

To code this part I had a variable be the input of a prompt to see whether they wanted a circle or a triangle. After that I had an if else statement that checked if it was a circle. The else statement for that if has another if statement inside of it to see if its a triangle. If the initial input was either a circle or a triangle it was then asked for dimensions that would then output the final area of the shape.

# Javascript

Finished the rock paper scissors game activity, also started with the regular javascript course.

# Web Design #1

#1 Nationstates.net):

The Nationstates website is great for a few reasons. First of all the layout is easy to navigate and nothing is difficult to find or confusing. The highlighted areas easily show important bits of information for yourself and the website as a whole. Also the information that needs to be shown is easily found and your eyes are drawn to the large highlighted text. In addition the banners and pictures don’t conflict with each other and the profile nation  I’m looking at (mine) is shown prominently and is not easily overlooked.