Landing : Athabascau University

Assignment 1

Last updated November 3, 2022 - 8:39pm by Matthew Woodhead

Assignment 1:

Problem 1:

My original approach was to start from scratch as I thought this would give me the best opportunity to fully learn and understand the code. Having completed a course in C++ some parts clicked much quicker than others. I think the biggest struggle for me was the formatting of my outputs for this problem as print statements and incrementing the table are things that translated pretty easily. After spending more time than I would like to think it should have taken, I eventually decided the better option for me, in this case, was to take already written code from the text and online resources and adapt them as I saw necessary. Hopefully, as I move through the course and reflect on some of these first problems it all starts to become second nature.

Problem 2:

Having spent a fair amount of time on the first problem, I seemed to have worked out a few kinks and was able to complete this one much more quickly. I handwrote what the program was meant to accomplish and then beside it wrote my best attempt at what the code would be in order to complete this. Once that was done I took to Wordpad to translate this into a working program. This was my first time using Scanner but it seemed to work out quite well. The only issue I ran into when testing the program was I had allowed lower and uppercase for Y/N but had forgotten to do so for F/C. This should have been a simple fix, which it eventually was but, of course, I overanalyzed things and assumed that I had missed some part of the code on the output, when in reality all I needed to do was add "|| ch='f'" which while frustrating at first turned out to be rather funny when I caught it.

Problem 3:

I enjoyed this problem as it seemed to be a good combination of the knowledge built in the first two problems. As the first problem had tackled how to print a table it was just a matter of using that program as the building blocks for the table here, the second problem had given us the info needed to actually make the conversions and how to write this as a code so it was just then trial and error to have the formatting in the print.out statement match what was asked for in the assignment.

Problem 4:

At this point taking user input and printing a statement is starting to become a little more natural so this was really about learning how to use switch statements to determine which case gets printed on screen. A quick search on google took me to Oracle's site which had a great example of this and could easily be modified to my needs for the program. The switch Statement (The Java™ Tutorials > Learning the Java Language > Language Basics) ( Then it was just a case of finding the proper definition for each term and running through each case to ensure that there were no errors in the program.

Problem 5:

I had done this problem in my C++ course so I got through this question pretty quickly. The only thing that really stood out on this one was just how long it took to actually run the program and print out the results, almost to the point that I had originally thought I had made a mistake and it wasn't running correctly, thankfully that wasn't the case.