Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write the code in C++ Objectives Familiarize the student with: using exceptions in real programs; the simplification of exception throwing; throwing exceptions in constructors.

please write the code in C++

Objectives

Familiarize the student with:

  • using exceptions in real programs;
  • the simplification of exception throwing;
  • throwing exceptions in constructors.

Scenario

IP header imagine you have a class or struct (choose one) describing an IP header which holds (apart from other fields) two string fields that contain Source IP Address and Destination IP Address. Check these two fields and throw an exception in a constructor, and using a special check method, try to write one version of this code only. The condition of the check method is that both IP numbers are valid. Start with simple checks the IP number must consist of four numbers in the 0-255 range, separated by a dot. Append appropriate information about which of the IP numbers is invalid.

212.112.212.11, 212.112.212.12 212.112.212.333, 212.112.212.33

Valid IP Header. Invalid IP Header - Source IP Address is invalid.

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

Students also viewed these Databases questions

Question

3. List ways to manage relationship dynamics

Answered: 1 week ago