Goal: Use branching, looping and other foundational C# concepts to build working console applications with C#. Don't worry about trying to complete all the exercises. Focus on getting more comfortable with C# and understanding key concepts.
Follow along with the pre-work's lessons and build out your dealership application. Then try adding additional static methods to give the
Car class interesting (and possibly quirky) functionality. You can pick from these suggestions or come up with your own:
Ping-pong is a classic programming exercise that utilizes branching and looping. Here's how it works:
If the user enters
15, the program will return:
1 2 "ping" 4 "pong" "ping" 7 8 "ping" "pong" 11 "ping" 13 14 "ping-pong"
Write a console ping-pong application.
Create a console application where the Sphinx asks a riddle and the user must answer the riddle correctly. If the riddle is answered correctly, the Sphinx asks a second riddle and so on.
In chess, a queen can move horizontally, vertically, and diagonally, making it the most powerful piece on the board. If another piece is within its line of sight along these three lines, the queen may attack it.
Create a console application where the user can enter X and Y coordinates for both a queen and another chess piece. The program should return whether the queen is capable of 'attacking' the other chess piece.
Queenclass, with properties for its X and Y coordinates.
Queenclass should have a method that takes X and a Y coordinate as arguments, and returns
trueif the queen can attack the given space, and
falseif it cannot.
Lesson 4 of 20
Last updated April 14, 2022