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

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

  Write a code fragment that would printout the multiplication

Write a code fragment that would printout the multiplication table for the number 3 multiplied by (1-10) .

  Create your own date class

You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following interface and main program:

  A mini game made in java using zen graphics

a mini game made in Java using Zen graphics .

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Write a java application to ask number of assignments

Write a java application that accomplishes the following tasks with built in exception handling: ask the number of homework assignment students have submitted in a semester

  Create an array of integers at random

create an array of integers at random with a range of 0 through 1000 in Java... any hints?

  Write a reference class called ctatrain

writing a reference class that consist of the 2nd and 3rd instance variables below. my class should consist of an array of values in the 2nd instance variable

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  You must also do the work of sorting

You must also do the work of sorting in the method. You cannot just call another library method. Use loops to show the data in the original array as well as the repopulated array in ascending order.

  Java program for line item application

This exercise explains you the process of testing and enhancing Line Item application. Open LineItemApp, Validator, Product, LineItem, and ProductDB classes that are in the c:java1.6ch06LineItem directory and review this code.

  Program that initializes an array with ten random integers

Write a JAVA program that initializes an array with ten random integers and then prints four lines of output, containing

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