Write a snippet of code to declare an exception class

Assignment Help Computer Engineering
Reference no: EM132134697

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.

Reference no: EM132134697

Questions Cloud

Normal distribution with a mean : We have a normal distribution with a mean of 71 and a standard deviation of 11
Partial relative frequency table : Given the following partial relative frequency table
Compute the t value of the sample test statistic : Use a level of significance of 0.05 to conduct a two-tailed test of the claim that the population mean is 11.5. Compute the t value of the sample test statistic
What networks were encountered along the way : What information about the geographic locations of the routers can you infer from the trace? What was the longest mean delay on any one hop along the way?
Write a snippet of code to declare an exception class : Write a try catch block of code, which invokes the treatPet method, catches PetBitesException and then invokes the errorHandler method.
How many results are possible to form the board : The Codechef Programming Society has 198 membership-paying mem- bers, 97 females and 101 males.
Display the rows in the vendor table : The bookstore has decided to keep track of the vendors' information. In order to do this, one new table will be added to the database.
Calculate the issue price of the bonds : On January 1, 2017 Lance Co. issued five-year bonds with a face value of $840,000, Calculate the issue price of the bonds
What is the probability that in the next six? flights : What is the probability that in the next six? flights, exactly four flights will be on? time?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Compromise confidential and sensitive military information

a breach of security on the contractor's computer systems could compromise confidential and sensitive military information

  Create a lan for a very successful cpa firm

You have been asked to design a LAN for a very successful CPA firm with five departments in one building and a total of 560 employees.recently , the firm has no networked computers, and it is open to any suggestions your team can offer.

  Describe the impact of changes in technology

Describe the impact of changes in technology on the field of digital forensics. Describe the details of how do the cloud services impact the field of digital forensics.

  List three advantage of separating the declaration from body

What is an Ada package? Why are packages important? Ada packages have two parts. List three advantages of separating the declaration from the body.

  Explain the z-transform of the following system transfer

Discrete Time Systems, 1. a) Find the z-transform of the following system transfer function assuming the input is a unit staircase (i.e. zero order held). The sampling rate is T=0.2.

  Describe the database

Describe the database, and how it is used to support business or personal functions

  What kinds of documents are poor matches

What kinds of documents are poor matches

  The currency conversion application is a menu-driven

the final project consists of a currency conversion application. this application-similar to simple practical programs

  How is a field name qualified how is this used when using a

sql built-in functionsanswer the following questions1. what is the simplest sql retrieval?2. what is the purpose of the

  Writing down the script

Write down a script known as whichdaemon.sh that checks if the httpd and init daemons are running over your system. If an httpd is running.

  Determine whether the given mersenne numbers are primes

Determine whether the following Mersenne numbers are primes: M. M29. and M31. Can this fact be used for primarily testing? Explain.

  How do you think the tools will work in the future

How do you think these tools will work in the future? How will they impact major societal concerns like education, jobs, or the economy?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd