Categories
Weekly Assignments

Code It Like It’s Hot

Assignment

As introduced in my about me, I am a double major in Mathematics and Computer Science. So you best believe that when I saw a ds106 coding assignment, I instantly started working on it. There is no better way to connect “What’s (y)our story” to my work, than by showing a part of my story through my work.


Behind the Work

Coding became a big part of my life when I took CPSC 110 for my math major elective during my sophomore year at UMW. I found myself looking forward to class and the chance to complete more work (weird I know). At the time, I was majoring in Chemistry and had been set on it since high school.

Coming into my junior year I wasn’t happy with my work in Chemistry, I didn’t love the material anymore, and I dreaded going to lab – I finally decided to switch my major to Computer Science. I’ve never felt so happy with where I am in my studies, than I do right now. Although, I might have to take an extra semester… but, I do NOT want to think about that.

Anyways, that’s why I chose this assignment to be my first assignment. By showcasing my passion, I am showing a big part of my story.

The actual coding part didn’t take as long as coming up with what to code. I decided to just type directly into the code embed option of the blog using JAVA. As one of the first coding programs I learned how to code was “Hello World!” I only found it fitting to do my own spin in my assignment.


During the Work

The program I created for the ds106 coding assignment greets a user based on their inputs for name and the time of day. For example, if the user were to tell the program their name is Ari and it is night. The program would say: “Good night Ari!”. I didn’t want to make the program too crazy, but still wanted to show some JAVA basics.

import java.util.Scanner;
/**
  * This program greets the user based on the time of day.
  *
  * @author Ariel Arison
  * @version 2/3/21
  */
public class SayHi {
      public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            System.out.println("Please enter your name: ");
            String name = input.next();
            System.out.println("Enter if it is day or night: )?");
            String time = input.next();
            if (time.toLowerCase().equals("day")) {
                  System.out.println("Good day " + name + " !");
            }
            else (time.toLowerCase().equals("night")) {
                  System.out.println("Good night " + name + " !");
            } 
      }
}

3 replies on “Code It Like It’s Hot”

This is honestly so cool. I don’t really know much about coding other than the fact that I struggle with it hahaha. So this amazes me with what you’ve done. Great job!

Leave a Reply

Your email address will not be published. Required fields are marked *