0% found this document useful (0 votes)
37 views1 page

Programming Tasks with Switch-Case

The document outlines programming exercises categorized into beginner, intermediate, and advanced levels. Beginner tasks include creating a weekday name program, a simple calculator, and a month days program. Intermediate challenges involve grade conversion, traffic light control, and season identification, while advanced tasks focus on a menu-driven program, Morse code conversion, command line parsing, and a number to word converter.

Uploaded by

geetapatel9578
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

Programming Tasks with Switch-Case

The document outlines programming exercises categorized into beginner, intermediate, and advanced levels. Beginner tasks include creating a weekday name program, a simple calculator, and a month days program. Intermediate challenges involve grade conversion, traffic light control, and season identification, while advanced tasks focus on a menu-driven program, Morse code conversion, command line parsing, and a number to word converter.

Uploaded by

geetapatel9578
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Beginner Level

Weekday Names: Write a program that asks the user for a number between 1 and 7 and
prints the day of the week corresponding to that number, with Sunday as 1 and
Saturday as 7.

Simple Calculator: Create a simple calculator that takes three inputs: two numbers
and an operator (+, -, *, /) from the user, and then uses a switch-case to perform
the operation and display the result.

Month Days: Write a program that asks for a month number (1 for January, 2 for
February, etc.) and prints the number of days in the month. Assume it's not a leap
year.

Intermediate Level
Grade to Points: Convert a letter grade (A, B, C, D, F) to points (4 for A, 3 for
B, etc.) using a switch-case. Assume no +/- grades.

Traffic Light Controller: Implement a switch-case statement that takes a string


input for a traffic light color ("red", "yellow", "green") and prints actions
("stop", "caution", "go") based on the input.

Seasons Finder: Given a month number, use a switch-case to print the season
(Spring, Summer, Fall, Winter) it belongs to.

Advanced Level
Menu-Driven Program: Create a menu-driven program using switch-case that has
options like Add, Delete, Search, and Exit. Allow the user to keep choosing options
until they decide to exit the program.

Morse Code Converter: Write a program that converts alphabets to Morse code. Use a
switch-case to map each letter to its Morse code equivalent. Start with a simple
version that handles individual letters only.

Command Line Parser: Design a simple command-line argument parser that takes
arguments like --help, --version, and --verbose and uses a switch-case to print
specific information for each command.

Number to Word Converter: Implement a switch-case statement that converts a digit


(0-9) into words (e.g., 0 to 'Zero'). Extend this to work for numbers in the range
of 1-99, breaking down the digits and translating them to words.

You might also like