Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OldPhonePad

A C# program that simulates the behavior of a old-school mobile phone keypad — supporting multi-tap text input, backspace, and send functionality. Input is provided via command-line arguments and converted into readable text.


📝Description

OldPhonePad is a C# console application that emulates the functionality of old-school mobile phone keypads. Users interact with the system using input strings consisting of keypad characters (1-9, 0, *, #), similar to how SMS messages were typed on feature phones.

This project includes both the main program and unit tests to validate input handling and output correctness.

How It Works

  • Accepts input as a string of keypad characters: 1234567890*#
  • Each key maps to a set of characters:
    • 2A B C
    • 3D E F
    • 4G H I
    • 5J K L
    • 6M N O
    • 7P Q R S
    • 8T U V
    • 9W X Y Z
    • 0 → space ' '
    • 1 → symbols & ' (
  • Pressing a key multiple times cycles through the characters
  • Use a space between inputs if two characters are on the same key (e.g., 44 444#HI)
  • * represents backspace
  • # represents send and signals the end of input

Features

  • Supports input via command-line arguments
  • Handles multi-tap behavior for text input
  • Includes backspace support with *
  • Stops processing input at the # key (send)
  • Comes with unit tests for various input scenarios
  • Accepts only valid characters: 1 2 3 4 5 6 7 8 9 0 * #

💻Requirments


🚀Getting Started

1. Clone the repository:

$ git clone https://github.com/Shivalux/OldPhonePad.git
$ cd OldPhonePad

2. Build the project:

$ make
  • This will generate an executable script: OldPhonePad.sh

3. Run the app:

./OldPhonePad.sh [INPUTS ...]
  • Use quotes for inputs containing * or spaces (e.g., "227*#", 22 2#)
  • If no input is provided, the program will run using example inputs.

🧰Makefile Commands

Command Description
make / make all Build the project and all dependencies
make test Run the unit test
make clean Clean the output of a previous build
make fclean Remove all bin/ and obj/ directory
make re clean and rebuild entire project

🧪Example

Run the App

Command

$ ./OldPhonePad.sh 33# '227*#' "4433555 555666#" "8 88777444666*664#"

What happens

  • Recive input: ["33#, "227*#", "4433555 555666#", "8 88777444666*664#"] as arguments
  • Convert each to readable text
  • Outputs results to the console

Output

OldPhonePad("33#") => output: |E|
OldPhonePad("227*#") => output: |B|
OldPhonePad("4433555 555666#") => output: |HELLO|
OldPhonePad("8 88777444666*664#") => output: |TURING|

Run Tests

$ make test

Output

Restore complete (0.2s)
  OldPhonePad succeeded (0.1s) → OldPhonePad/bin/Debug/net9.0/OldPhonePad.dll
  OldPhonePad.Tests succeeded (0.1s) → OldPhonePad.Tests/bin/Debug/net9.0/OldPhonePad.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 9.0.10)
[xUnit.net 00:00:00.03]   Discovering: OldPhonePad.Tests
[xUnit.net 00:00:00.06]   Discovered:  OldPhonePad.Tests
[xUnit.net 00:00:00.06]   Starting:    OldPhonePad.Tests
[xUnit.net 00:00:00.10]   Finished:    OldPhonePad.Tests
  OldPhonePad.Tests test succeeded (0.5s)

Test summary: total: 37, failed: 0, succeeded: 37, skipped: 0, duration: 0.5s

👥 Authors & Acknowledments

Created by @Shivalux

⚖️License

This project is licensed under the MIT License.
See the LICENSE file for more information.

About

IRON C# Code Challenge

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages