Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Write a Java program to practice the use of Java file I/O. Class methods are needed to break up solution in smaller parts.
Program will read several series of heart rates from a file, compute min, max, & fitness quotient for each series, and output the input data and computed info in an HTML document.

The following 3 files are attached:

1.sample-input.txt, which is a small sample input file,

2.sample-output.html, which is a small sample output file corresponding to the sample-input.txt input file,

3.many-heart-rates.txt, which is a big sample input file.

Problem:

You have been hired by a medical research group, led by a famous cardiologist that has developed something they call the fitness quotient. The idea is to have a person walk on a treadmill for several minutes and to take his/her heart rate measurement a couple times a minute. This leads to a series of heart rates, e.g., <60,66,72,75,72,74>. The person's fitness quotient is twice the smallest heart rate in this series, divided by the sum of the smallest and largest heart rates. (Notice that neither the duration of the test nor the frequency of heart rate measurements is important, and in general these may vary from test to test and from individual to individual without affecting the fitness quotient.) For example, the individual whose heart rates are those in the above example would have a fitness quotient of 0.889 = (2*60)/(60+75).
The medical research group is interested in a program that will read a file containing heart rate measurements for several anonymous individuals, and will create from it an HTML file that looks like this when viewed in a browser:

Fitness Quotient Minimum Heart Rate Maximum Heart Rate Heart Rate Series
0.919 68 80 68, 69, 76, 78, 77, 77, 78, 80
0.887 67 84 67, 69, 78, 83, 83, 84, 79, 82, 79, 84, 83, 82, 83, 84, 79, 83, 80, 78, 84, 84
0.894 63 78 63, 71, 73, 78, 76

The program will be invoked with two command line arguments, the input file name and the output file name.

The program will perform the following actions:

1.Open an input file whose name is the first argument to the program (args[0]), by using a BufferedReader object

2.Open an output file whose name is the second argument to the program (args[1]), by using a PrintWriter object

3.Output to the file the appropriate opening HTML tags

4.Output to the file the header row of the table

5.For each series of heart rates in the input file, do the following: 1.Input the series of numbers from the input file and store them in an array 2.Compute the min, max, & fitness quotient for the series 3.Output one row of the HTML table to the output file, with the fitness quotient, min & max heart rates, and the list of heart rates 6.Output to the file the appropriate closing HTML tags 7.Close the input and output files.

Make sure to handle all possible IOException exceptions generated by the file I/O calls.
The input file will contain heart rate measurements for several anonymous individuals in the following format:





...




...
...
where the first line is the number of heart rate series in the input file; after that, is the length of the first heart rate series, which is followed by the corresponding number of heart rate measurements, one per line of the input file. Each following heart rate series follows the same format. See sample-input.txt and many-heart-rates.txt for sample input files in this format. Note that the solution has to work with an input file following this format but with an arbitrary number of heart rate series.

The output file format will be HTML. The general structure of the program's output will be the following:


...


The body of the HTML output file will contain a table.


Attachment:- sample-input.zip

Java, Programming

  • Category:- Java
  • Reference No.:- M91619229
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

  • 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