Constructor that accepts a file name as its argument

Assignment Help JAVA Programming
Reference no: EM13166355

Write a class with a constructor that accepts a file name as its argument. Assume the file contains a series of numbers, each written on a separate line. The class should read the contents of the file into an array, and then displays the following data.
* The lowest number in the array
* The highest number in the array
* The total of the numbers in the array
* The average of the numbers in the array.

The file, Numbers.txt used for the above program contains these twelve numbers:
8.71
7.94
3.01
29.27
9.23
82.76
12.6
47.99
63.89
1.09
22.23
79.17

Reference no: EM13166355

Questions Cloud

Calculate its molar heat of vaporization : The vapor pressure of dichloromethane,CH2Cl2, at 0 C is 134 mmHg. The normal boiling point of dichloromethane is 40 C. Calculate its molar heat of vaporization.
Equal rental payments are due on january : The term of the noncancelable lease is6years, with no renewal option. The equipment reverts to the lessor at the termination of the lease and equal rental payments are due on January 1 of each year, beginning in 2012.
Calculate the heat of combustion of propane : burning 480 cm3 of propane measured at r.t.p,caused the temperture of 250 cm3 of water to increase by 42.5 celsius. calculate the heat of combustion of propane.
Identify and correct the errors : Identify and correct the erros in the following program. void nPrintln(string message, int n){int n=1;for (int i=0; i int main (){nPrintln(5, "Welcome to C++!");}
Constructor that accepts a file name as its argument : Write a class with a constructor that accepts a file name as its argument. Assume the file contains a series of numbers, each written on a separate line. The class should read the contents of the file into an array, and then displays the following..
Estimate the radius of the molecules : The critical constants of ethane are Pc = 48.20 atm, Vc = 148 (cm^3)/mol, and Tc = 305.4 K. Calculate the van der Waals parameters of the gas, and estimate the radius of the molecules.
Method summarizesequences that takes a string as a parameter : Now implement the method summarizeSequences that takes a String as a parameter. This method should open the file named by this String, and read a sequence from that file into an array list using the getSequence method you wrote above
Writing return statement in a value returning function : What would be wrong with not writing returnstatement in a value returing function? Can you have a returnstatement in a void function? Does the return statement in the following function cause syntax error?
What are the data entities of this enterprise : Consider a student club or organization in which you are a member. What are the data entities of this enterprise? List and define each entity

Reviews

Write a Review

JAVA Programming Questions & Answers

  Develop java package comprising of class using encapsulation

Develop the Java package comprising of Class and Student with the given requirements. Encapsulation, Method to print student details alone.

  Correct example of inheritance

Which of the following relationships is not a correct example of inheritance?  Parent to Children  Aunt to Uncle  Grandparent to Grandchild

  Write a recursive method to produce a pattern

Write a recursive method to produce a pattern of n lines of asterisks.

  Design a program that extends the definition of the class

Design a program that extends the definition of the class JFrame to display a window on the screen. Name your class PropertyTax1, title your window "Calculation of Property Taxes," set the window's width to 400 pixels and height to 300 pixels, and te..

  Difference between the two following statements

What exactly is the difference between the two following statements and which is preferred, please provide details: 1) frame.setSize(400, 300); // Set JFrame Size

  Write a class called rationalnumber

Write a class called RationalNumber that represents a fraction with an integer numerator and denominator.

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Write a java program that will read a sequence of names

Write a java program that will read a sequence of names (first name followed by last name, separated by at least one space) from a text file and will 1) remove all duplicate names and 2) write the names (last name followed by a comma, followed by one..

  Implement/update specific methods for the dfs of a graph

implement/update specific methods for the DFS of a graph; for at least 2 graphs (1 being the provided one), show the DFS order of vertices in the graph, and for each node,

  What is the minimal total weight of cylinders

A scuba diver uses a special equipment for diving. He has a cylinder with two containers: one with oxygen and the other with nitrogen. Depending on the time he wants to stay under water and the depth of diving the scuba diver needs various amount of ..

  Modify each sorting algorithm

Modify each sorting algorithm so that it keeps track of the number of comparisons it performs and the number of exchanges (swaps) it performs during a single sorting operation. Keep track of these numbers using two long integer counters

  Java applet to find how much federal tax we need to pay

Write a java applet to determine how much federal tax we need to pay assuming the tax rate is 12%.  Ask the taxable income.

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