Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Write the C++ full main.cpp for the first screenshot titled, "Project 25.1"
Then write full main.cpp mystring.h, and mystring.cpp for the second screenshot titled, "Project 25.2"
Transcribed Image Text:Project 25.2
SYLLABUS PROJECTS LESSONS
In this assignment you will use the MyString class that you wrote earlier in this course.
A palindrome is a string that reads the same forward and backward. Write a program that reads in any number of MyStrings from the user and determines if each MyString is
a palindrome. The user will terminate each MyString by pressing the return (or enter) button. The user will indicate that there are no more MyStrings by entering "quit".
To do this you must write a recursive function named isAPalindrome that takes a single MyString argument and two arguments that are bounds on MyString indices. The
function must examine the part of the argument between the two bounds (including the bounds) and return true if this part of the argument is a palindrome, false if it is not a
palindrome. The function must be recursive and must not call any other functions except ispunct(), isspace(), and toupper() (described below).
Do not make any changes to the MyString class (except, if necessary, to correct errors in your MyString class). In particular, note that the isAPalindrome() function is not part
of the MyString class. Your client file, main.cpp, will contain your main() function and your isAPalindrome() function. Do not use the C++ string class or arrays or vectors or
any other container other than MyString.
Follow this sample output closely:
Enter a string: Able was I, ere I saw Elba
Able was I, ere I saw Elba is a palindrome.
Enter a string: peanut butter
peanut butter is not a palindrome.
Enter a string: quit
In determining whether a string is a palindrome, this function must consider uppercase and lowercase letters to be the same and ignore punctuation characters and
whitespace characters. You must not modify the argument in any way or make a copy of the argument to accomplish this. The simplest way to handle uppercase/lowercase
issues is to make everything uppercase on the fly, right at the instant that you are comparing the two characters.
Full documentation is required.
Hints:
•
You will want to use three functions that are in the cctype library (i.e. you must #include cctype to use them). They are ispunct(char), a bool function which returns true
if its argument is a punctuation mark and false otherwise, isspace(char), which returns true if its argument is a whitespace character and false otherwise, and
toupper(char), which returns the uppercase equivalent of its argument (without changing the argument itself).
• I strongly suggest that you first write this program so that it works in the general case (i.e. assuming that all letters are uppercase and no characters are punctuation
characters or whitespace characters), and then add code to handle the uppercase/lowercase and punctuation/whitespace issues.
•
Make sure you try a palindrome that starts and ends with the same letter but is not a palindrome. Returning a false positive in this case is one of the most common
errors that students make.
• Another common error is calling this value-returning function as if it was a void function. You can't say "isAPalindrome (str1, leftBound, highBound);" on a line by itself.
It doesn't do anything.
•
•
Also, make sure that every case in your function has a return statement. Often students submit programs that worked perfectly for them, but they were just getting
lucky, and the computer was returning the correct value by chance when there was no return statement.
If leftBound > rightBound, that means that the MyString under consideration is the empty string. An empty string reads the same forward and backward, so it is a
palindrome.
Transcribed Image Text:Project 25.1
SYLLABUS
PROJECTS LESSONS
Write a recursive function named reverseWithinBounds that has an argument that is an array of characters and two arguments that are bounds on array indices. The function
should reverse the order of those entries in the array whose indices are between the two bounds (including the bounds). For example, if the array is:
a[0]
== 'A' a[1] == 'B' a[2] == 'C' a[3]
== 'D' a[4] == 'E'
and the bounds are 1 and 4, then after the function is run the array elements should be:
a[0]
==
'A' a[1]
==
'E' a[2]
==
'D' a[3] =
== 'C' a[4] == 'B'
Embed the function in a program and test it. After you have fully debugged this function, define another function named reverseCString that takes a single argument that is a
C string and modifies the argument so that it is reversed. This function will include a call to the recursive definition you did for the first part of this project, and need not be
recursive. Embed this second function in a program and test it. Turn in only this final result.
Full documentation is required.
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 2 steps
Knowledge Booster
Background pattern image
Similar questions
- Write a C++ program that will use good object-oriented principles.You have been tasked to write an application that will allow a user to change their system password. The XYZ Corporation has the following rules for passwords: each password should have a minimum of 8 characters each password should have a minimum of 2 uppercase characters (A - Z) each password should have a minimum of 2 lowercase characters (a - z) each password should have a minimum of 2 digits (0 - 9) each password should have a minimum of 2 special characters of which the following characters are allowed: !, @, ,ドル %, and & (in any combination) Once the user has created a new password that passes the above requirements, the user must then retype the password for the program to verify that the same password was entered by the user. If the user creates a password that does not meet the minimum requirements, be sure to let the user know the entered password does not meet the minimum requirements and allow the...arrow_forwardwrite a program to point the area of a rectangle by creating a class named 'Area' having two functions. the first function named as 'setDim' takes the length and breadth of the rectangle as parameters and the second function named as 'getArea' returns the area of the rectangle. length and breadth of the rectangle are entered through the keyboard. (using c++ language)arrow_forwardThis is your first activity that is labelled as a "project." You should use your IDE to develop projects instead of typing them directly into zyBooks. Also, some projects will be reviewed by me to ensure that requirements and style conventions have been met. The main objective for this first project is to get your IDE set up and successfully compile and execute your first C++ program. You may assume that the user will provide properly formatted, valid data. The date June 10, 1960 is special because when we write it in the following format, the month times the day equals the year: 6/10/60 Write a program that asks the user to enter any date in the format specified above (month/day/2-digit-year). (It is very important that the input is in the correct format, typed all at once, all on one line, by the user. See the hints below.) The program should then determine whether the month times the day is equal to the year. If so, it should display a message saying the date is magic. Otherwise it...arrow_forward
- Please give me correct solution.arrow_forwardHelp with this C++ Data Structures Project Using good OOP, write a C++ program that will determine if a string has balanced delimiters. Be sure to use good programming methodology and keep your project modular.Use private member functions and variables.Use public member functions for a constructor (where appropriate) and a driver method only.These specifications do not give a list of method names to be used. It is assumed the program will use several methods doing one task each.NOTE: Any submission that uses global variables or does not use a class and object appropriately will result in a project grade of 0.A string may use more than one type of delimiter to bracket information into blocks. For example, a string may use braces { }, parentheses ( ), and brackets [ ] as delimiters.A string is properly delimited if each right delimiter is matched with a preceding left delimiter of the same type in such a way that either the resulting blocks of information are disjoint, or one of them...arrow_forwardCreate a C++ address book using the following information: The address should contain a Person class. string firstName; string middleName; string lastName; Each person’s detailed address should be provided as follows: int block; int unit; int floor; string street; string city; string country; int postalCode; Write appropriate getters/ setters and test your implementation.arrow_forward
- By implementing the concepts of Classes and Objects, write a C++ program that determines the slope of a line from the coordinates, P(x,y), of the 2 points. The coordinates of the 2 points: P1 (x1, y1) and P2 (x2, y2) are to he entered from the keyboard. The slope, m, of the line is computed as: m=(y2-y1/x2-x1) Accomplish the following for the given class diagram: 1.) Create the class implementation using C++ 2.) Using the constructor, create 2 objects, P1 and P2, from class Point and store them in the heap memory. 3.) Implement the functions of the 2 objects. NOTE: The member function setXY is used to enter the values of x and y from the keyboard. Sample input/output display: Enter the coordinates of the 1st point (x1 y1): 1 1 Enter the coordinates of the 2nd point (x2 y2): 5 4 The slope of the line, m=0.75arrow_forwardLanguage is C++ Lab14A: The Architect. Buildings can be built in many ways. Usually, the architect of the building draws up maps and schematics of a building specifying the building’s characteristics such as how tall it is, how many stories it has etc. Then the actual building itself is built based on the schematics (also known as blueprints). Now it is safe to assume that the actual building is based off the blueprint but is not the blueprint itself and vice versa. The idea of a classes and objects follows a similar ideology. The class file can be considered the blueprint and the object is the building following the analogy mentioned above. The class file contains the details of the object i.e., the object’s attributes (variables) and behavior (methods). Please keep in mind that a class is a template of an eventual object. Although the class has variables, these variables lack an assigned value since each object will have a unique value for that variable. Think of a form that you...arrow_forwardWriting C++ Code for a Hybrid Market Prize System. A New hybrid market is launching in Muscat and you are asked to create a prize system for the blind customers based on the amount of his invoice. The scenario of giving the prize is as follow: • The market owner should enter the Secret amount (SM), Above Percentage (AP). Lower Percentage (LP) and Prize at the start of executing the system. • The cashier should enter the following information for five customers in a 2D-Array 5 X 3: The Invoice Number, the Invoice Amount, and Customer Name • The system needs to print the number and the amount of each invoice with the customer name. In addition to the prize amount, such that: o it the Invoice Amount is equal to (SM) the record of the customer should be printed with 100% of the Prize. o If the Invoice Amount is Larger than (SM) by (AP) the record of the customer should be printed with 50% of the Prize. o If the Invoice Amount is larger than (SM) by (LP) the record of the customer should be...arrow_forward
- Create a social network, Chirper, that lets the user add new Chirps and like existing Chirps. It's lonely because only one person can add and like messages -- so there's really not much "social" about it. At least you can practice using objects, references, and function overloading in C++! Here's an example of how this program will run You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? chirp What's your message? This is my first chirp! Chirper has 1 chirps: 1. This is my first chirp! (0 likes) You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? like Which index do you want to like? 1 Chirper has 1 chirps: 1. This is my first chirp! (1 likes) You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? chirp What's your message? Second chirp is the best chirp. Chirper has 2 chirps: 1. This is my first chirp! (1 likes) 2. Second chirp...arrow_forward49. Write a C program that will find the sum of all prime numbers in a given range. The range will be specified as command line parameters. The first command line parameter, N1 which is a positive integer, will contain the lower bound of the range. The second command line parameter N2, which is also a positive integer will contain the upper bound of the range. The program should consider all the prime numbers within the range, excluding the upper bound and lower bound. Print the output in integer format to stdout. Other than the integer number, no other extra information should be printed to stdout. Example Given inputs "7" and "24" here N1= 7 and N2=24, expected output as 83.arrow_forwardWrite a program in C++ that reads a list of enrollments from a file and prints a class roster for the teacher. The program would use files, functions, and classes.Here's what the output should look like: $ ./enroll.out Welcome to the Roster Generator Program!!! Please enter the name of your names file: bob.dat I'm sorry, I could not open 'bob.dat'. Please enter another name: csc442 File 'csc442' opened successfully! Name | Major | Phone # | Town ----------------+--------------------+---------------+------------------- Jason James | Computer Science | 555/555-1122 | Westfalia, HI 665 Faruk Ahmed | Medeaval French Po | 332-4546 | Slimsville, PQ 22 Sean Ramirez | Underwater Basket | 1-444/411-441 | Fritter, HO 44331 Happy Gilmore | Yellow Tail Migrat | | Simonton, SZ 1124 Total Enrollment: 4 Thank you for using the RGP!! Endeavor to have a gyroscopic day! $arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education