Write a function that converts the string to all uppercase

Assignment Help Programming Languages
Reference no: EM131349713

Programming Assignment

INTRODUCTION

You'll be creating a menu-driven main program for processing strings, but you'll do this by first writing a set of functions, and then using those functions inside a main program.

Specific deliverables and deadlines will be given for each piece of this assignment. You must complete and submit each piece by the given deadline. Missing any deadline will disqualify you from further consideration on this assignment (in other words, your entire assignment will be graded based only on what you've submitted up to that point).

Submissions will be in the form of a PDF file, showing:

• your well-commented source code;
• its behavior on the given test cases; and
• its behavior on two additional test cases of your own choosing.

Specific commenting guidelines will be given below, and proper commenting will form an essential part of your grades.

PROGRAM OVERVIEW

Here is an overview of the program you'll be writing. The next section will discuss how you should develop your program.

Functions

Write the following functions. Each of these functions should have a single parameter -- accepting a c-style string as an argument.

The function should only do what is specified (note that none of these functions do any output to the screen):

1. Write a function that counts and returns the number of vowels in the string. (For the purposes of this exercise, we are talking about the standard 5 vowels -- A, E, I, O, U

(upper- or lower-case)).

2. Write a function that counts and returns the number of consonants in the string.

3. Write a function that converts the string to all lowercase.

4. Write a function that converts the string to all uppercase.

Main Program

Write a main program that performs the following steps:

1. Prompt the user to enter a string, and let them type it in.

This could be an entire sentence, with the newline indicating the end of the string. You may assume the string will be no more than 100 characters, so declare your array accordingly.

2. Display the following menu:

A) Count the number of vowels in the string
B) Count the number of consonants in the string
C) Convert the string to uppercase
D) Convert the string to lowercase
E) Display the current string
F) Enter another string
M) Display this menu
X) Exit the program

3. Enter a loop, allowing the user to type in a menu choice each time. Loop should continue until the user enters the command to exit. Upper and lowercase letters should be allowed for the menu choices. If more than one character is entered, only use the first character.

•When the A or B commands are entered (counting vowels or consonants), call the corresponding function, then print the result
•When the C or D commands are chosen, just call the appropriate function to convert the string. Do not do any output from main on these commands.
•When E is chosen, print the contents of the stored string.
•When F is chosen, allow a new string to be typed - this will replace the previous one.
•If an unknown command is entered, display the message

"Unknown Command: enter M for help"

•The menu should only be displayed once at the start, and then again whenever the M option is selected Sample Run (user input is underlined, to distinguish it from output):

Input a line of text, up to 100 characters:

> The quick brown fox jumped. The lazy dog, he was jumped over.

A) Count the number of vowels in the string
B) Count the number of consonants in the string
C) Convert the string to uppercase
D) Convert the string to lowercase
E) Display the current string
F) Enter another string
M) Display this menu
X) Exit the program

Enter your menu selection: a
Number of vowels: 16
Enter your menu selection: B
Number of consonants: 31
Enter your menu selection: c
Enter your menu selection: e

The string:

THE QUICK BROWN FOX JUMPED. THE LAZY DOG, HE WAS JUMPED OVER.

Enter your menu selection: D
Enter your menu selection: E
The string:
the quick brown fox jumped. the lazy dog, he was jumped over.
Enter your menu selection: f
Input a new line of text, up to 100 characters:
> Mary Had A Little Lamb. His name was Fleecy Pete.
Enter your menu selection: C
Enter your menu selection: e

The string:

MARY HAD A LITTLE LAMB. HIS NAME WAS FLEECY PETE.
Enter your menu selection: d
Enter your menu selection: E
The string:
mary had a little lamb. his name was fleecy pete.
Enter your menu selection: b
Number of consonants: 24
Enter your menu selection: a
Number of vowels: 14
Enter your menu selection: x
Goodbye

Reference no: EM131349713

Questions Cloud

List of the risk in your department on emirates airline : List of the risk in your department on emirates airline. Select the risk as per the risk drives: (financial risk, structure risk, operation risk, hazard risk) do the same which is in the attached about risk drives
Advantages and disadvantages of voip : Explore the advantages and disadvantages of VoIP, and how they factor into business concerns in today's networking environments.
What impact does the discrepancy between wealth and poverty : What impact does the discrepancy between wealth and poverty in the United States have on society - What are some of the emotional and physical consequences of poverty on individuals?
What happens to the temperature of the exterior surface : Compare the results with the analytical solution. If the heat transfer coefficient increases to 10,000 W/m2 °C, what happens to the temperature of the exterior surface?
Write a function that converts the string to all uppercase : CSE 224- Write a function that counts and returns the number of consonants in the string. Write a function that converts the string to all lowercase. Write a function that converts the string to all uppercase.
Calculate the outer wall surface temperature : Use one linear element and two linear elements for the solution. Compare the results with the analytical solution.
Describe methods of determining the reliability of a measure : What is meant by the reliability of a measure? Distinguish between true score and measurement error.- Describe the methods of determining the reliability of a measure.
Explain the difference between accreditation and licensure : Define accreditation .Explain the difference between accreditation and licensure.Describe the history of accreditation in the United States.Outline the current and future challenges with accreditation.
Types of homeless people that the author discusses : Choose two of the types of homeless people that the author discusses. Then, complete the template found under the assignment icon below. Your Assignment needs to be at least two pages in length.

Reviews

Write a Review

Programming Languages Questions & Answers

  Explain encapsulation of data and methods

Explain the following three key concepts of object-oriented technology. Illustrate each one using examples. a) Encapsulation of data and methods b) Support for polymorphism c) Inheritance within class hierarchies.

  Create a default string of cars in main

Build the default constructor first. Create a default string of cars in main. Build an output function, similar to the old one, but dereferrencing the pointers.

  Write a short memo to the vice-president of production

Formulate a linear program that can be used to determine the optimal product mix for the chemical company. Specifically, do the following: Identify the decision variables (make sure that you specify the units for these variables). Specify the obje..

  Write a program to define constant

Display each of these constants in decimal, in hexadecimal, and as a character usingcout.

  Why you think additional personnel are generally required

Why you think additional personnel are generally required during the later stages of systems implementation? In addition, how do training activities differ between end users and system operators? Why?

  Implement a single pole-filter design program

This lab requires you to use C++ class composition to implement a single pole-filter design program. The program will allow the user to specify resistor and capacitor values and filter type

  Input number by user and display positive and negative

Input a number entered by the user and display "positive" if it is greater than zero, "negative" if it is less than zero, and "zero" if it is equal to zero.

  Write a program that will calculate number of square feet

write a program that will calculate the number of square feet (living space) in a 4-room house. Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem.

  Find the negation of each of statements

Use de Morgans law to find the negation of each of the subsequent statements - kwame will take a job in industry or go to graduate school.

  Linux directory log

Linux Directory Log, Directions: As you complete each of the following steps, keep track of what occurs at each point, including what you type, the output given, and if you experience any errors. Record the occurrences in the following matrix.

  Program to find real and complex roots of quadratic equation

Write a VBA program to find the real and complex roots of the quadratic equation.

  Web applications enable interaction between organizations

Web applications enable interaction between organizations and their clients. Find an interesting Web application on the Internet and present a short summary, and then answer the following prompts. 1. Why did you choose this application? 2. What kind ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd