Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Is there someone to help me on to write c++ code?

A) Write a snippet of code to declare ( what would go into the .h file) and then implement(what go into the .cpp file) an exception class called PetBitesException which holds an error message ,and a method called erroHandler which prints a message to a log file errorlog . The message is set by the custom constructor. Assume the log file has been already opened, and is globally available.

B) Write a snippet of code to declare (what would go into .h file) and then implement (what go into .cpp file) a public void method called treatPets scoped to PetHospital class, which takes a reference to Pet object , and throws PetBitesException if a Pet's mood attribute is set to "annoyed" . The exception needs to ouput a message identifying the Pet(example "Rufus just bit"), where pet's name class and the Pet class with all its attributes have been already implemented.

C) Write a try catch block of code, which invokes the treatPet method, catches PetBitesException and then invokes the errorHandler method on the exception object to log the error message.

D) Objective: class hierarchy and polymorphishm. Write a code snippet of code to declare (what would go into .h file) and then implement (what would go into .cpp file) the family of classes in Quality Control domain including,

- the base class "Test"

- two derived classes corresponding to the specialize tests: RegressionTest and LoadTest

The base class should have a virtual Boolean method called run which is overridden in the sub-classes, where specified logic is placed(some code).

As an exercise, let the method return true false randomly. Then in main.cpp file, declare a pointer to the base class Test and use it to instantiate and run LoadTest. Then use the same pointer to instantiate and run a RegressionTest.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93122162

Have any Question?


Related Questions in Computer Engineering

What data management considerations must be reviewed to

What data management considerations must be reviewed to ensure success for both companies and assure regulatory compliance, ethical responsibility, and business performance?

Couriers such as ups and fedex complete on service and

Couriers such as UPS and FedEx complete on service and price. One way to reduce cost is to keep labor cost low by hiring and laying off workers to meet the demand. This strategy requires managers to hire and train new wo ...

Questionif a string is stored at the memory address 0 times

Question: If a string is stored at the memory address 0 times 20008000 and the string is "Cortex-M", show the memory content in hex format starting at 0 times 20008000. How many bytes does this string take in the memory? ...

The ages of commercial aircraft are normally distributed

The ages of commercial aircraft are normally distributed with a mean of 13.5 years and a standard deviation of 8.3821 years. What percentage of individual aircraft have ages between 10 years and 16 years? Assume thata ra ...

Question project risk management planpurpose this project

Question: Project: Risk Management Plan Purpose: This project provides an opportunity to apply the competencies gained in the lessons of this course to develop a risk management plan for a fictitious organization to repl ...

Looping structures can be very helpful when coding an

Looping structures can be very helpful when coding an application. These are designed for iterative statements that need to happen multiple times. There are several looping structures you can utilize in C++, For, While a ...

Create a class named horse that contains data fields for

Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these fields. Next, create a subclass named RaceHorse, which contains an additional field that hol ...

Question in a survey of 182 insurance policies the

Question : In a survey of 182 insurance policies, the following data was obtained 67 policy holders are female. 89 policy holders are under age 30 62 policy holders are married 35 policy holders are women under age 30 31 ...

When talking about economics and the history of it for the

When talking about Economics and the history of it. For the past recessions the U.S. has had, do we look at it mostly on the loan side of the banks or what causes most recessions?

You run a small pizza shop named pizza hat initially you

You run a small pizza shop named Pizza Hat. Initially you sold pizzas for $8 and every week you sold around 3000 pizzas. Each pizza costs you $3 to make. One day you decided to over discounts to customers to see if you c ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As