Write program that can be used to read an extract from a log

Assignment Help JAVA Programming
Reference no: EM13865200

Program 3 (console)

The qualities that are most important to the Redding Elevator Company are safety and reliability. Both are achieved by high standards of design, manufacture and service. All elevators are serviced regularly, but even so, there will be unexpected failures. The long term goal is to minimise their frequency to enhance the quality reputation of the products and the company.

Each elevator's computerised controller maintains a log of the times it is put into service tup and the times at which it fails tdown. This log is transmitted to the company to build a statistical pro le of the reliability of each elevator and, collectively, of each elevator model.

The main metric used to describe reliability is the mean time between failures (MTBF), the sum of all of the failure times tdown minus the time it last came into service tup divided by the number or failures.

MTBF = Σ(tdown - tup)/ number of failures

Write a program that can be used to read an extract from a log for one elevator and print the following statistics:

1. the total \uptime", that is the total time the elevator was in service, Σ(tdown - tup) (in years);

2. the number of failures; and

3. the MTBF (in years).

The log extract excludes scheduled times the elevator was taken out of service for maintenance. A typical log looks like this:

- Each line consists of a U to label a time as a tup or a D to label a time as a tdown, followed by the time in seconds since the elevator was rst put into service.

- The rst line will always indicate tup at 0 seconds.

- The last line is usually also a tup, though it is possible that the log has been uploaded while the elevator is out of service, and therefore the last line is a tdown.

- A fairly new elevator that has not failed yet may have a log with only one line in it.

File: S00000001.txt

U

0

D

15664610

U

15670184

D

30700326

U

30724536

D

37622324

U

37648485

D

60455362

U

60480874

D

79166234

U

79181602

D

95881395

U

95892167

Some more example log les: S00000002.txt (only one line); S00000003.txt (f nishes with a tdown); S00000004.txt (longer).

For the purposes of the calculations, assume there are 365:25 days per year. Your program should read a log le from standard input, using input redirection.

Example output for these four data fles:

$ java AnalyseOne < S00000001.txt

Total uptime = 3.035229865389003 (years)

Number of failures = 6

Mean time between failures = 0.5058716442315004 (years)

$ java AnalyseOne < S00000002.txt

No failures.

$ java AnalyseOne < S00000003.txt

Total uptime = 4.63133147007377 (years)

Number of failures = 3

Mean time between failures = 1.5437771566912568 (years)

$ java AnalyseOne < S00000004.txt

Total uptime = 13.717806709001954 (years)

Number of failures = 9

Mean time between failures = 1.5242007454446616 (years)

$

Reference no: EM13865200

Questions Cloud

Generate a sequence of exponentially : Consider an exponentially distributed RV with a=0, use the inverse transform method to generate a sequence of exponentially distributed random numbers for different values of the parameter b. Plot the histograms (probability density function (pdf))..
Find electric potential and calculate equivalent capacitance : Find the electric potential, V, at the origin, (0,0), for the given configuration of all three charges shown. (You may assume that the electric potential is eaual to zero at infinity. i.e. V(∞).
What is the optimal order size : 1. The annual demand for an item is 10,000 units, each order costs $120 and the annual holding cost is 35 percent of unit cost. The unit cost depends on the quality ordered as follows:
Difficult to estimate the magnitude of the benefits : Why is it difficult to estimate the magnitude of the benefits of completing the internal market of the EU?
Write program that can be used to read an extract from a log : Write a program that can be used to read an extract from a log for one elevator and print the following statistics: the total \uptime", that is the total time the elevator was in service, Σ(tdown - tup) (in years).
Design a discrete proportional plus : Design a discrete (Z-domain) proportional plus integral plus derivatives (PID) controller for the type-1 plant derived from Lab 2. The controller should satisfy the following specifications:
Explicate the diplomatic doctrine the president followed : Explicate the diplomatic doctrine the president followed, with reference to specific actions or events that occurred.
That we identified from the completion of the internal marke : Look through the costs and benefits that we identified from the completion of the internal market. Do the same costs and benefits arise from the enlarged EU of 27 members?
Analyst for the department of homeland security assigned : analyst for the Department of Homeland Security assigned to the Office of Intelligence and Analysis

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a java code to count number of capital letters in line

Write a java codenpseudo-code to count the number of capital letters in a line of text. How many comparisons does it do? What is the fewestnumber of increments it might do? What is the largest number?

  Length of the string in order to reserve space

To determine the length of the string in order to reserve space for the new string use the library routine strlen. Register a1 contains a pointer to the string to measure and on return register a1 has the number of characters in the string. You..

  Implement a game of tic-tac-toe

Specify, design, and implement a class that can be one player in a Game of tic-tac-toe. The constructor should be specify whether the object is to be the first player (X's) or the second player (O's).

  What is the definition of a run-time error

What is the definition of a run-time error? How are exceptions and exception handling related to run-time errors

  Java :a user-defined starting position (other than 0,0)

modifying the program so that it can start from a user-defined starting position (other than 0,0) and search for a user defined ending point (other than row-1, column-1) .

  Implement a recursive method that returns xn

implement a recursive method that returns xn - Suppose we want methods that compute the value of a double precision number raised to an integer power.

  Write a recursive method that takes two non-negative integer

Write a recursive method that takes two non-negative integers m and n as parameters and returns the product.

  Write a one-class java program

Write a one-class Java program with at least one method (besides main) to determine if the data in your dataset (i.e., in data.txt) follows Benford's law.

  Banking program that simulates the operation

Write a banking program that simulates the operation of your local bank. Declare the following class

  In this project you need to write a program called gf2java

in this project you need to write a program called gf2.java to implement the finite field gfpnwhere p is a prime number

  Create a program that has an object type of contact

Create a program that has an object type of Contact. This contact will need to have the following attributes: Name, Birth Date, Phone Number, Address and Eye Color

  What are the merits and demerits of the use of mainframes

write a 200- to 300-word short-answer response to the followingwhat are the advantages and disadvantages of the use of

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