Coding Challenges for Spring 2018 have improved a great deal.  The first few challenges are designed to get you to break your own mental barriers and move toward applying your design and programming skills into the world of mobile app development.  These challenges start with SPR2018 and end with a number. 

 

A new coding challenge is announced and posted here each Friday or Monday.  Should you decide to accept a challenge, you and/or your team will have one week to complete and submit your challenge entry.  All entries are due the following Friday, unless they go unsolved.

Coding.  Challenges. 
The first challenge for the Fall 2018 semester has been posted.

 

Always check the LeaderBoard (below) to congratulate those who are participating and to see who has bragging rights as the top scorer. 
Prizes will range from points to tech gifts to cash.

 

Rules are listed below.  Please remember, you can work alone or with a team.

 

RULES:
  • All submission details, attachments, links, etc. must be submitted via email to csu.hacks@gmail.com unless otherwise instructed.
  • If a particular coding challenge has no winner, the challenge remains open until someone solves it.
  • If a submission is a copy of code found on the web, the entry will be disqualified.
  • No late entries will be accepted unless the challenge has not yet been won.
  • Only solutions for challenges that have been solved by someone will be shown.

=================================================================================

CODING CHALLENGES HAVE BEEN PUT ON HOLD AND WILL RESUME SPRING 2019.

Coding Challenge Fall 2018 #4: Due Friday, September 21, 2018 @ 5pm

Points: 10 (5 additional points go to the person who submits 1st)

Status: OPEN

Using the Java language, create a method SecondGreatLow(arr) that takes the array of numbers stored in arr and return the second lowest and second greatest numbers, respectively, separated by a space…

Sample Test Cases

Input:1, 42, 42, 180

Output:“42 42”

Input:4, 90Output:“90 4”

Coding Challenge Fall 2018 #3: Due Friday, September 14, 2018 @ 5pm

Points: 15 (5 additional points go to the person who submits 1st)

Status: OPEN

Using the Java language, have the function KaprekarsConstant(num) take the num parameter being passed which will be a 4-digit number with at least two distinct digits. Your program should perform the following routine on the number: Arrange the digits in descending order and in ascending order (adding zeroes to fit it to a 4-digit number), and subtract the smaller number from the bigger number. Then repeat the previous step. Performing this routine will always cause you to reach a fixed number: 6174. Then performing the routine on 6174 will always give you 6174 (7641 – 1467 = 6174). Your program should return the number of times this routine must be performed until 6174 is reached. For example: if num is 3524 your program should return 3 because of the following steps: (1) 5432 – 2345 = 3087, (2) 8730 – 0378 = 8352, (3) 8532 – 2358 = 6174.

Sample Test Cases

Input: 2111

Output: 5

Input: 9831

Output: 7

 

Coding Challenge Fall 2018 #2: Due Friday, September 7, 2018 @ 5pm

Points: 15

Status: SOLVED

Given a number N as input (either from a user, an array, or a file) that represents where the minute hand currently is on a clock. Your program should return the angle that is formed by the minute hand and the 12 o’clock mark on the clock.

Example

If the input is: 15 then your program should return 90 because a 90-degree angle is formed by the minute hand and the 12 o’clock mark on the clock.

 

Coding Challenge Fall 2018 #1: Due Tuesday, September 4, 2018 @ 5pm

Points: 10

Status: SOLVED

Challenge:
Using the Java language, have the function StringChanges(str) take the str parameter being passed, which will be a string containing letters from the alphabet, and return a new string based on the following rules…
Sample Test Cases:
1)

Input:“MrtyNNgMM”

Output:“rtyggg”

2)
Input:“oMoMkkNrrN”

Output:“ooookkr”

 

===================================================

Coding Challenge SPR2018 #4: Due Monday, April 9, 2018 @ 5pm

Points: 20

Write a Java program to play the rock-paper-scissor game. Each of the two users types in either R, P, or S.  The program then announces the winner as well as the basis for determining the winner (e.g. Paper covers rock, rock breaks scissors, scissors cut paper, or nobody wins).  Your program should allow the players to use lowercase as well as uppercase.

LEVEL UP

Points: 10

Your program should allow each player to enter his/her name.  The player’s name is displayed with the winning move.

 

 

VALID SUBMISSION:  Your entry should include: *.java file, all appropriate text files, and the html document generated with your documentation comments.

 

Coding Challenge SPR2018 #3: Due Monday, April 2, 2018 @ 5pm -> SOLVED!

Points: 20

Write a java class that creates a file, writes the alphabet to that file, and then prints the content of that file (the alphabet) on the screen.  Your class should ask the user for the name of the file and path where the file should be stored.  The name of the file should also be written/stored on the top line of the file.

Your code should use exception handling, appropriate documentation comments, and you should print out as much information about the file as possible.  This will make more sense when you read more about the file and files classes in the java.io package.

LEVEL UP:

Points: 15

Write a java class that prints your favorite poem to a file.

VALID SUBMISSION:  Your entry should include: *.java file, all appropriate text files, and the html document generated with your documentation comments.

 

 

Coding Challenge SPR2018 #2: Due Friday, March 9, 2018 @ 5pm

Due: March 9, 2018 @ 5pm
First & Second Place prizes are on display in the Math & CS Office.

Beginners: (Spring 2018 CoSc 199 & CoSc 220 – Object First Cohort)
Points: 40

Design a Geometry class with the following methods:

  • A method that accepts the radius of a circle and calculates and prints the area of the circle.  Use the following formula:
    • (Extra 10 points) Use the Math.PI
  • A method that accepts the length and width of a rectangle and calculates and prints the area of the rectangle.
  • A method that accepts the length of a triangle’s base and the triangle’s height and calculates the area of the triangle.
  • (Extra 20 points) The method should display the error message if the negative values are used for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height.

Intermediate: (Those who can already write Python or Java code)
Points: 40

Imagine you are developing a software package for MindGrub.com that requires users to enter their own passwords.  Your software requires that user’s passwords meet the following criteria:

  • The password should be at least six characters long.
  • The password should contain at least on uppercase and at least one lower case letter.
  • The password should have at least one digit.

Write a program that verifies that a password meets these stated criteria.  The program should allow the user to enter a password and then displays a message indicating whether it is valid or not.

Extra 10 points:  Print a message that states the password will expire in # of weeks.  This # equals the amount of characters present in the final correct password.
Extra 20 points:
  Store all password creation attempts in an array and print all elements of the array until a correct password is created.

 

 

Coding Challenge SPR2018#1: Due Friday, February 16, 2018 @ 5pm

For this challenge, pick a native mobile app development platform with which you wish to work.  Many of you may have to select Android because iOS requires a Mac.  But no worries.

Create an Android Developer account.  Download and install Android Studio and find and complete a tutorial to create a simple app that displays “Hello  World”.  Create a GitHub or BitBucket account and share your code.  Send a link to csu.hacks@gmail.com by the deadline above.  You may also want to complete a GIT tutorial, if you don’t already know how to use it.

NOTE:  Native Android apps are made with Java – so this should be fun since Java is our chosen language.

Points: 60

 

Coding Challenge #5: Due Friday, November 17th @ 5pm

This coding challenge comes in two levels to match programmer experience level: Beginner and Intermediate

Beginners (use Scratch, Java, or Python):  30 points

Using the Design Recipe, write a program that asks for (consumes) a users number of school credits and prints (produces) their classification here at Coppin State.

Intermediate (use Python or Java): 30 points

Using the Design Recipe, write a program that asks for (consumes) a series of letter or numbers and sorts and prints (produces) them in ascending order.

 

NOTE:  The coding challenge due November 10th was skipped.

Coding Challenge #4:  Due Friday, November 3rd @ 5pm
[NO WINNER YET]

This coding challenge comes in two levels to match programmer experience level: Beginner and Intermediate

Beginners (use Scratch, Java, or Python):  30 points

Using the Design Recipe, write a program that accepts 5 numbers from a user and tells whether numbers are even and odd.

Submission Instructions:  Send your Scratch project URL to csuhacks@gmail.com.

Intermediate (use Python or Java): 30 points

Using the Design Recipe, write a program that stores a given int array => ex. [0, 3, 4], and creates a new array with double the length where its last element is the same as the original array, and all the other elements are 0 => ex. [0, 0, 0, 0, 3, 4]. 

Submission Instructions:  Send your code via github to csuhacks@gmail.com

Questions?  Email csuhacks@gmail.com

=================

Coding Challenge #3:  Due Wednesday, October 25th @ 5pm
[WINNERS = JERRY & TYLER]

The code in the image above doesn’t execute. What’s wrong? (10 points)

This challenge is a bit easy, thus the low amount of points.  Look at it as a confidence builder! 🙂

ANSWER:  The line that reads:

return a * b

….doesn’t have a semi-colon at the end.

And in the line that reads:

public static Double multiply (Double a, Double b) {

…should read ‘double’ in all cases – ‘D’ will not compile.

 

NOTE:  Java classes do not need to have a main method.  Java classes are ‘blueprints’ of methods.  They do not need to have a main method.  A main method tells the JRE (Java Virtual Machine) where execution of the program begins.

So, this means the above code can be used as such…

 1 public class challenge {
 2 
 3    public static double multiply (double a, double b) {
 4 
 5       return a * b;
 6 
 7    }
 8 
 9    public static void main (String[] args) {
 10       System.out.print(multiply(5.4, 3.2));
 11       
 12    }
 13 }

Feel free to type the above code in your favorite Java IDE to see it run.  Test various values for a & b.

=================

Coding Challenge #2:  Due Friday, October 20th
[PYTHON WINNER: Sagar – 10/27/2017
JAVA WINNER: Paolo – 2/9/2018]

Write a program in your preferred language that consumes a binary number and produces its decimal equivalent. (40 points)

*See Sagar’s solution on his github page.  All student github pages are shared on the Github tab at the bottom of the LeaderBoard (above).

=================

Coding Challenge #1:  Due Friday, October 13th
[EVERYONE WHO SUBMITTED RECEIVED POINTS]

Learn git and create a github account. Share your github URL here. (20 points)