Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, the student will write a program that analyzes a single keystroke and classifies that keystroke with conditional logic. When completing this assignment,

In this assignment, the student will write a program that analyzes a single keystroke and classifies that keystroke with conditional logic.

When completing this assignment, the student should demonstrate mastery of the following concepts:

Individual Character Input with scanf()

IF, IF-ELSE, IF-ELSE Chain Logic

SWITCH-CASE Logic

Preprocessor Directive Flags

Flagging

Assignment:

Write a program that prompts the user to enter a single keystroke and stores the character pressed in a char variable. The program then processes the keystroke and determines if the keystroke was a letter, numeral, or symbol. If the keystroke was a letter, display a message indicating whether the letter is a vowel or consonant. If the character is a numeral, information about whether the numeral is even or odd is displayed. If the character is a symbol, information is displayed indicating whether the symbol is found in the lower ASCII table (7 bit representations) or the upper ASCII table (8 bit representations).

Your program should make use of #define codes to classify the keystroke. Your program should contain at least one instance of an IF, IF-ELSE, IF-ELSE-CHAIN, and SWITCH-CASE structure. Use the following shell to start your program:

#include

#ifndef __CHARCODES__

#define __CHARCODES__

// Type codes...

#define LETTER 1

#define NUMBER 2

#define SYMBOL 3

// Sub-type codes...

#define VOWEL 4

#define CONSONANT 5

#define ODD 6

#define EVEN 7

#define UPPER_ASCII 8

#define LOWER_ASCII 9

#endif

int main() {

char keyStroke = 0;

int typeCode = -1, subTypeCode = -1;

// GET THE KEYSTROKE (remember to clean phantoms)

// ANALYZE THE KEYSTROKE (IF, IF-ELSE, IF-ELSE-CHAIN here)

// DISPLAY RESULTS BASED ON SET CODES (SWITCH-CASE)

return 0;

}

The output should looks as follows:

image text in transcribed

C-A04-Character Analyzer au clusers markieldesktop work sturf sprosias 111 (01,02h 03)b-weekly assignments project fold. he character you entered was "9" That is a NUMERAL he NUMERAL is DD Press any key to continue Example #3 as clusersimarkieldesktoplwork stuffispr09icis 111(002h,03 weekly assignmentsiproject fold. he character you entered was "a" That is a SYMBOL. The SYMBOL can be found in the UPPER ASCII table. Press any key to continue Assessment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

11. Are your speaking notes helpful and effective?

Answered: 1 week ago

Question

The Goals of Informative Speaking Topics for Informative

Answered: 1 week ago