Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Problem

Create the Java source code files for the classes listed in the inheritance hierarchy displayed in Figure 10-63a. Create a new Java source code file and enter code for the FinalTest.java test program, as shown in Figure 10-63b on page 686. Compile all source code and execute the test program to obtain the output as displayed in Figure 10-63c on page 686. Perform the following steps to complete these tasks:

1. The abstract base class, Security Alarm, has three constant values used for the state of the alarm: no alarm, sensor failure, and activated alarm. One method, alarm Failure(), cannot be overridden by any subclass. The other two methods, alarm() and sensor Sample(), are abstract.

2. The class, Entry Alarm, inherits from Security Alarm and has a single constant value as a threshold. If the simulation of the alarm sensor exceeds the threshold, the entry alarm is triggered. An Entry Alarm does not fail; it either signals no alarm or it activates an alarm.

3. The class, Fire Alarm, inherits from Security Alarm and has two constant values. One indicates a maximum temperature threshold. If the simulation of the alarm sensor exceeds the threshold, the fire alarm is activated. The other constant indicates a temperature failure threshold, to prevent false alarms. If the simulation of the alarm sensor yields a temperature below this value, the fire alarm has malfunctioned. The source code for this class, FireAlarm.java, is located in the Chapter10 folder on the Student Data Disk.

4. The class, CO Alarm, inherits from Security Alarm and has two constant values. One indicates a maximum carbon monoxide threshold. If the simulation of the alarm sensor exceeds the threshold, the carbon monoxide alarm is activated. The other constant indicates a carbon monoxide failure threshold, to prevent false alarms. If the simulation of the alarm sensor yields a carbon monoxide level below this threshold, the carbon monoxide alarm has malfunctioned.

5. The sensor Sample() method is used to simulate alarm conditions by generating a random number value simulating a sensor reading. If the alarm is activated, this method calls the alarm() method. If the alarm fails, this method calls the alarm Failure() method. Compile all source code and execute the test program to obtain the output as displayed in Figure 10-63c on the next page.

 

1845_Figure 10-63a.jpg

1218_Figure 10-63b.jpg

Computer Engineering, Engineering

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

Have any Question?


Related Questions in Computer Engineering

Determine whether or not the following claim is true for

Determine whether or not the following claim is true for all regular expressions r 1  and r 2 . The symbol ≡ stands for equivalence regular expressions in the sense that both expressions denote the same language.  (a) (r ...

Systems analysis projectpersonal trainer inc owns and

Systems analysis project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a new "superce ...

1 define organizational communication2 what interesting

1. Define organizational communication 2. What interesting about the subject of organizational communication

Requirementsin this assignment you will implement a

Requirements In this assignment, you will implement a lightweight version of an ArrayList class. You may refer to the Java code and documentation for guidance, but you must write the implementation yourself. Additionally ...

In 2005 team dad used a toyota truck with a system of

In 2005, Team DAD used a Toyota truck with a system of spinning lasers as its "visual" system. What advantages and or disadvantage does such a system have compared to camera-based systems?

Say you want to match ip addresses however its likely that

Say you want to match IP addresses. However, it's likely that an invalid IP address such as 192.168.1.256 will match with your regex as well. What would you would need to do to validate that an IP address is valid, and w ...

Each of the following lists has an average of 50 for which

Each of the following lists has an average of 50. For which one is the spread of the numbers around the average biggest?smallest? a. 0, 20, 40, 50, 60, 80, 100 b. 0, 48, 49, 50, 51, 52, 100 c. 0, 1, 2, 50, 98, 99, 100 Gu ...

Need help with a java program that takes two arrays a and b

Need help with a Java program that takes two arrays a and b of length 5 storing int values, and returns the dot product of a and b. That is, it returns an array c of length n such that c[i]=a[i]*b[i].

Given a list of numbers l a value x is said to be a

Given a list of numbers L, a value x is said to be a majority value if the value of over half the elements in L is x; in other words, if L has n elements and nx is the number of elements in L with value x, then x is a ma ...

A compute the sumnbsps1nbsp 1 2 3 nbsp nbsp 9999 the sum

(a) Compute the sum S1 = 1 + 2 + 3 + . . . + 9999 (the sum of all integers from 1 to 9999). Do not use a program. (b) Compute the sum S2 = 1+3+5+...+9999 (the sum of all odd integers from 1 to 9999). Do not use a program ...

  • 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