Question: Chapter 5 C-Programming Projects 2. The following table shows telephone area codes in the state of Georgia along with the largest city in each area:

Chapter 5

C-Programming Projects

2. The following table shows telephone area codes in the state of Georgia along with the largest city in each area:

Area code

Major city

229

Albany

404

Atlanta

470

Atlanta

478

Macon

678

Atlanta

706

Columbus

762

Columbus

770

Atlanta

912

Savannah

Write a switch statement whose controlling expression is the variable area_code. If the value of area_code is in the table, the switch statement will print the corresponding city name. Otherwise, the switch statement will display the message "Area code not recognized". Use the techniques discussed in Section 5.3 to make the switch statement as simple as possible.

Write your answer here:

2.

C-Programming Projects

5.3

1. Using the switch statement, write a program that converts a numerical grade into a letter grade:

Enter numerical grade: 84

Letter grade: B

Use the following grading scale: A = 90~100, B = 80~89, C = 70~79, D = 60~69, F = 0~59. Print an error message if the grade is larger than 100 or less than 0. Hint: Break the grade into two digits, then use a switch statement to test the tens digit.

1. Write your program here:

#include

int main(){

return 0;

}

2. Write a program that asks the user for a two-digit number, then prints the English word for the number:

Enter a two-digit number: 45

You entered the number forty-five.

Hint: Break the number into two digits. Use one switch statement to print the word for the First digit (twenty thirty" and so forth). Use a second switch statement to print the word for the second digit. Dont forget that the numbers between 11 and 19 require special treatment.

2. Write your program here:

#include

int main(){

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!