Please write your own original code. Objective Create a program that initializes and works with string variables. Create a program named LastnameFirstname15.c, that does the following: Note: There is no user input for this program. 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"; 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. Use the strlen function to get the lengths of each name and store them in separate variables. Calculate the total length of your name by adding the lengths of the first name and last name and store it in another variable. Using the char arrays of your name, print your first and last name along with the lengths of each. Print the total length of your name. Ensure all of the output above is labeled appropriately. Loop through the first name array and print out each letter in lowercase on its own line in a staircase fashion. 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. Hint: Use an inner for-loop to print out the spaces. To ensure the letters are all lowercase, use the tolower function. Loop backwards through the first name array and print out each letter in uppercase on its own line in reverse staircase fashion. Looping backwards means the loop starts at the last index of the array and goes down to index 0. Reverse staircase fashion means the amount of spaces is reversed from what it would be if looping forward. To ensure the letters are all uppercase, use the toupper function. Loop through the last name array and print out each letter in toggle case on its own line in a staircase fashion. Toggle case means the casing of the letter is continuously alternating between upper- and lowercase. To accomplish toggle case, print letters at even numbered indexes as uppercase and letters at odd numbered indexes as lowercase. 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please write your own original code.

  • Objective
    • Create a program that initializes and works with string variables.
  • 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.
      1. 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.
      2. Hint: Use an inner for-loop to print out the spaces.
      3. 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.
      1. Looping backwards means the loop starts at the last index of the array and goes down to index 0.
      2. Reverse staircase fashion means the amount of spaces is reversed from what it would be if looping forward.
      3. 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.
      1. Toggle case means the casing of the letter is continuously alternating between upper- and lowercase.
      2. 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.
### 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
```

The output demonstrates a program that processes two names: "Edward" and "Meyer". The program calculates and prints the length of each name and their total combined length. 

Following that, it displays a pattern formed by stacking letters from both names in alternating upper and lower cases. The sequence begins with the letters of "Edward" followed by "Meyer", and then repeats with alternating cases. 

Ensure the program logic captures both analyzing text input and creatively displaying information.
Transcribed Image Text:### 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 ``` The output demonstrates a program that processes two names: "Edward" and "Meyer". The program calculates and prints the length of each name and their total combined length. Following that, it displays a pattern formed by stacking letters from both names in alternating upper and lower cases. The sequence begins with the letters of "Edward" followed by "Meyer", and then repeats with alternating cases. Ensure the program logic captures both analyzing text input and creatively displaying information.
Expert Solution
Step 1

C-INTRODUCTION:-

Early in the 1970s, the high-level programming language C was created. It was developed to be compiled using a reasonably straightforward compiler and was intended to be used as a system programming language.
The characteristics of both high-level and low-level languages are combined in C, which is regarded as a middle-level language.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education