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.

Video

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()) {
             column.get(z).add(s.charAt(o));
         } else {
             column.get(z).add('x');}}}

-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.

 

L1 portfolio

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]);
    }
  }
}

L2P Daily Challenge June 19

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.

My python code

 

 

 

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.

#2 Youtube.com):

The youtube website while viewing videos is great for multiple reasons. the highlighted areas are key to what the website shows and they are displayed prominently and larger compared to the rest of the page. This means that you are less likely to glaze over something important and instead view it as it is supposed to. In addition the color scheme of the website is easy on your eyes and it is not distracting. It is also easy to navigate the important parts of the website such as the search bar, subscribed list, and your personal profile.

 

#3 Razerzone.com

This website is great for multiple reasons. The website is made up of three main components, the navbar, a slideshow that highlights new products and website news, and another bar highlighting products and recommendations. This allows for easy navigation and allows a viewer to be drawn immediately to the content that is important. In addition the background colors don’t distract and don’t draw you away from the main parts of the website.