Young Coders: Week 1 Problems

Candy Challenge!

Finish at least 3 out of 5 of the following problems correctly to win candy/chocolate. Email your solutions to me, plus two or three of your favorite types of candy/chocolate. If you have any questions about the problems themselves, ask in the comments below this post.


1) Read in two Strings using a Scanner. Print them out in an alternating pattern. For example, if the user inputs “hot” and “cold”, print out “hotcoldhotcold”.

2) Read in a String using a Scanner. Print out the first three letters. If the String’s length is less than three, just print out the String.

3) Read in a String using a Scanner. Print out the second half of the word. For example, if the word is “hooray”, print out “ray”. Assume the word’s length is an even number.

4) Read in a String using a Scanner. Print out the word without its first
and last letter. For example, if the word was “computer”, print out “ompute”.

5) Read in a String using a Scanner. Print out “yes” if the word ends in “ing”. Print out “no” otherwise. For example, if the word is “jumping”, print out “yes”. 



Popular posts from this blog

Building A Toy Language Interpreter in Go

Space Race: a simple Rust game built on the Bevy framework

Building a Toy Language Compiler in Go