Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective Create a program that initializes and works with string variables. Related SLO Develop properly structured multifile programs with automatic compilation. Implement arrays and

image text in transcribedimage text in transcribed

Objective Create a program that initializes and works with string variables. Related SLO Develop properly structured multifile programs with automatic compilation. Implement arrays and pointers in C. Instructions A. Create a makefile named makefile that will automatically compile, link, and create an executable for this assignment. This assignment will not require any external files such as getdouble.c, getdouble.h Ensure your makefile is named makefile and not any other name. B. Create a program named LastnameFirstname15.c, that does the following: 1. Note: There is no user input for this program. 2. Declare and initialize a char array that stores your first name in title case. Title case means the first letter is uppercase and the rest is lowercase. Ensure the size/length of the array is equal to the length of your name plus the null character. As an example, my first name is Edward, therefore the size of the array will be 7. char firstname [7] = "Edward"; 3. Declare and initialize another char array that stores your last name in title case. Ensure the size/length of the array is equal to the length of your name plus the null character. 4. Use the strlen function to get the lengths of each name and store them in separate variables. 5. Calculate the total length of your name by adding the lengths of the first name and last name and store it in another variable. 6. Using the char arrays of your name, print your first and last name along with the lengths of each. 7. Print the total length of your name. 8. Ensure all of the output above is labeled appropriately. 9. Loop through the first name array and print out each letter in lowercase on its own line in a staircase fashion. i. Staircase fashion means that starting from the second letter, output one space in front of the letter and increase the amount of space by 1 for each letter thereafter. In other words, the third letter should have 2 spaces in front, the fourth letter should have 3 spaces and so on. ii. Hint: Use an inner for-loop to print out the spaces. iii. To ensure the letters are all lowercase, use the tolower function. 10. Loop backwards through the first name array and print out each letter in uppercase on its own line in reverse staircase fashion. i. Looping backwards means the loop starts at the last index of the array and goes down to index 0. ii. Reverse staircase fashion means the amount of spaces is reversed from what it would be if looping forward. iii. To ensure the letters are all uppercase, use the toupper function. 11. Loop through the last name array and print out each letter in toggle case on its own line in a staircase fashion. i. Toggle case means the casing of the letter is continuously alternating between upper- and lowercase. ii. To accomplish toggle case, print letters at even numbered indexes as uppercase and letters at odd numbered indexes as lowercase. 12. The program should work for any name that is stored in the arrays. For example, if I change the first name to "Bananabanana" with array size 13, the program will still work without changing anything else. 13. Ensure your program has the proper includes for the different functions you will be using for this program. Use the lecture slides to see which header files need to be included in your program. Activate Go to Set 14. Be sure to have a program description at the top and in-line comments. Be clear with your comments and output to the user, so I can understand what you're program is doing. Be sure to have read through the assignment policy for this class. Example Output % make % ./program First name "Edward" has length 6. Last name "Meyer" has length 5. Total length: 11 e d W a r d D R A W D E M e Y e R

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

Introduction To Health Care Management

Authors: Sharon B. Buchbinder, Nancy H. Shanks

3rd Edition

128408101X, 9781284081015

More Books

Students also viewed these Programming questions

Question

The domain of the variable in the expression x 3/x + 4 is________.

Answered: 1 week ago