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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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