subject

The first programming project involves writing a program that computes the minimum, the maximum and the average weight of a collection of weights represented in pounds and ounces that are read from an input file. This program consists of two classes. The first class is the Weight class, which is specified in integer pounds and ounces stored as a double precision floating point number. It should have five public methods and two private methods:A public constructor that allows the pounds and ounces to be initialized to the values supplied as parameters. A public instance method named lessThan that accepts one weight as a parameter and returns whether the weight object on which it is invoked is less than the weight supplied as a parameter. A public instance method named addTo that accepts one weight as a parameter and adds the weight supplied as a parameter to the weight object on which it is invoked. It should normalize the result. A public instance method named divide that accepts an integer divisor as a parameter. It should divide the weight object on which the method is invoked by the supplied divisor and normalize the result. A public instance toString method that returns a string that looks as follows: x lbs y oz, where x is the number of pounds and y the number of ounces. The number of ounces should be displayed with three places to the right of the decimal. A private instance method toOunces that returns the total number of ounces in the weight object on which is was invoked. A private instance method normalize that normalizes the weight on which it was invoked by ensuring that the number of ounces is less than the number of ounces in a pound. Both instance variable must be private. In addition the class should contain a private named constant that defines the number of ounces in a pound, which is 16. The must not contain any other public methods. The second class should be named Project1. It should consist of the following four class (static) methods. The main method that reads in the file of weights and stores them in an array of type Weight. It should then display the smallest, largest and average weight by calling the remaining three methods. The user should be able to select the input file from the default directory by using the JFileChooser class. The input file should contain one weight per line. If the number of weights in the file exceeds 25, an error message should be displayed and the program should terminate. A private class method named findMinimum that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the smallest weight in that array. A private class method named findMaximum that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the largest weight in that array. A private class method named findAverage that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the average of all the weights in that array. Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different input files to completely test the program. Java programmingThe text file could not be attached but it looks like this:Year, Weight in Lbs, Weight Loss Rate1994,713.6,91995,684.5,8.21996, 636.6,7.41997,611,6.81998,567.6,6.3 1999,523,5.72000,506.5,5.52001,504. 5,5.62002,494.4,5.62003,475.8,5.720 04,463.2,5.52005,469,5.62006,479.3, 5.82007,471.8,5.72008,458.6,5.42009 ,431.9,52010,404.5,4.82011,387.1,4. 72012,387.8,4.72013,367.9,4.5please tell me what to do? How to get the problem done.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
After you clean an engine with hot water spray, it seems to stall; when it doesn't stall, it's idling noisily. technician a says to check for loose bolts on the flex plate near the torque converter. technician b says to wipe down the spark plug wires and the distributor cap. who is correct? a. technician a b. both technicians a and b c. technician b
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
In a heat transfer course, we can derive the equation for the temperature distribution in a flat rectangular plate. in this example, we will look at a plate at steadystate with three sides being held at t1, and one side held at t2. the temperature for any location on the plate, t(x,y), can be calculated by where create a function (prob3_5) that will take inputs of vectors x and y in feet, scalar n, scalars l and w in feet and scalars t1 and t2 in degrees fahrenheit. it will output a matrix t which is the temperature of each x and y locations. t will have the number of columns equal to the number of elements in x and rows equal to the number of elements in y. though this can be done without loops (perhaps more efficiently), your program must use a nested loop.
Answers: 2
question
Computers and Technology, 24.06.2019 15:30
What is the function of compilers and interpreters? how does a compiler differ from an interpreter?
Answers: 2
question
Computers and Technology, 24.06.2019 17:00
Carlos, an algebra teacher, is creating a series of powerpoint presentations to use during class lectures. after writing, formatting, and stylizing the first presentation, he would like to begin writing the next presentation. he plans to insert all-new content, but he wants to have the same formatting and style as in the first one. what would be the most efficient way for carlos to begin creating the new presentation? going under the file tab and opening the first presentation, deleting all content from each page, and adding new content going under the file tab and clicking on new in the left pane, then choosing new from existing going under the design tab and clicking on themes, then selecting the theme that was used for the first template going under the design tab and opening the template that was created for the first presentation
Answers: 2
You know the right answer?
The first programming project involves writing a program that computes the minimum, the maximum and...
Questions
question
Mathematics, 29.10.2019 18:31
Questions on the website: 13722363