Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please code the following function in C++ bool isValidOrderString(string orders) This function returns true if its parameter is a well-formed order string, and false otherwise.

image text in transcribedplease code the following function in C++

bool isValidOrderString(string orders)

This function returns true if its parameter is a well-formed order string, and false otherwise.

Precisely, to be a valid order string, the string - can contain only the uppercase letters C, V, S as well as digit characters o, 1, 2, 3, 4, 5, 6, 7, 8 and 9 and the characters : and _ - must start with digits(s) - a groups of digits must be separated by : and then followed by either 1,2,3,C,V or S - additional groups of digits separated by : and then followed by either 1,2,3,C,V or S must be preceded with a - - no extra or unused characters once the digit groups are fully processed - no more than 50 items of any kind - no negative or zero quantities - no extra leading zeros in any number quantities All of the following are examples of valid order strings: - 1:1_1:2_1:3_1:C_1:S_1:V (one of each menu item) - 10:1 (ten combo 1 's) - 1:1_5:1_4:1 (ten combo 1's) All of the following are examples of invalid order strings: - xyz (bad characters) - 1:c (lowercase letters not supported) - 1:1 zzz (to be valid, all characters must be consumed. the extra characters at the end will make this string invalid) - 100:1 (morethan 50 items or more total) - 10:1_20:1_30:2 (more 50 items or more total) - 40:1_10:2_1:3 ( 5 o items or more total). - 40:C_10:V_1:S (morethan 5 items or more total). - 40:1_10:2 (50 items or more total). - 40:C_10:V .50 items or more total). - 40:C (spaces anywhere are not allowed)

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

More Books

Students also viewed these Databases questions

Question

Prepare an electronic rsum.

Answered: 1 week ago

Question

Strengthen your personal presence.

Answered: 1 week ago

Question

Identify the steps to follow in preparing an oral presentation.

Answered: 1 week ago