Question: Problem 6 Read input from a user that is intended to consist of a license number (such as a driver's license number). If the input

Problem 6

Read input from a user that is intended to consist of a license number (such as a driver's license number). If the input is not a valid license number, then ask again, and continue asking until the input is valid.

We'll say, for the purposes of this problem, that a license number must follow these rules in order to be valid:

It must consist only of uppercase letters and digits; anything else (including spaces) would make it invalid.

The first and last characters must be uppercase letters.

There must be at least one digit (and any number of uppercase letters) in between.

By these rules, the following are all valid license numbers: A123B, ABC1DEF, A1B2C3D4E. These would all be invalid: A123, 123B, ABCDEF, A1B2C3D4.

Problem 7

Given a string of text and a character to search for, count the number of times that the search character occurs in that string. For example, in the string Boo is not boolean, the search character oappears five times, while the search character b appears once (because upper- and lowercase are considered distinct).

Problem 8

Given a string of text, determine whether it is a palindrome. A palindrome is text that consists of letters that would look the same whether you printed them in order or in reverse order. So, for example, HANNAH is a palindrome, but HELLO HELLO is not.

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!