Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

please help with using C++ The public interface of a class for storing and validating South African mobile/cellphone numbers is given in Listing 1. class

image text in transcribed

image text in transcribed

please help with using C++

The public interface of a class for storing and validating South African mobile/cellphone numbers is given in Listing 1. class NobilePhoneNumber \{ public: I/ validates the number, throws Invalidnumber exception if the number // is not valid MobilePhoneNumber (const string\& nunber); I/ returns the 2-digit network operator code string getNetworkoperatorCode() const; // returns the 7-digit core number string getCorellumber() const; ) 3 ; Listing 1: Public interface for the MobilePhoneNumber class Valid phone numbers meet the following requirements: - They contain either 10 or 12 characters. All characters are digits from 09 inclusive except for the first character in the case of a 12-character number which is a " + " (see below). There are no spaces, parentheses etc. - The phone number has the following format: country code, followed by network operator code, followed by the core number. - The country code for a 12-character number must be " +27 "; the country code for a 10 -character number must be " 0". - The network operator code consists of two digits. Only the following set of codes are valid: {72,82,73,83,74,84} - The core number consists of the last seven digits. You are required to: (a) Provide a number of unit tests to verify that the MobilePhoneNumber class behaves as expected. The googletest framework's symtax and assertions are given in Listing 5 in the appendix. (10 marks (b) Provide all of the implementation details for the Mobi lePhoneNumber class. Listing 5: googletest Pramework: Syntax and Assertions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions