Programming Project 1 The first programming project involves writing a program that computes the…

Programming Project 1 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: 1. A public constructor that allows the pounds and ounces to be initialized to the values supplied as parameters. 2. A
Programming Project 1 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: 1. A public constructor that allows the pounds and ounces to be initialized to the values supplied as parameters. 2. 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. 3. 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. 4. 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. 5. 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. 6. A private instance method toOunces that returns the total number of ounces in the weight object on which is was invoked. 7. 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. 1. 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. 2. 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. 3. 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. 4. 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. Grading Rubric: The following grading rubric will be used to determine your grade: Attribute Meets Weight class 40 points It should have five public methods and two private methods: 1. A public constructor that allows the pounds and ounces to be initialized to the values supplied as parameters. 2. 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. 3. 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. 4. 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. 5. 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. 6. A private instance method toOunces that returns the total number of ounces in the weight object on which is was invoked. 7. 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. Project1 class 40 points It should consist of the following four class (static) methods. 1. 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. 2. 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. 3. 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. 4. 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. Test Cases 10 points Test cases are supplied in the form of table with columns indicating the input values, expected output, actual output and if the test case passed or failed. Select at least 3 different input files to completely test the program. Test cases were included in the supporting word or PDF documentation. Documentation and Style guide 10 points Screen captures were provided and labeled for compiling your code, and running each of your test cases. Header comments include filename, author, date and brief purpose of the program. In-line comments used to describe major functionality of the code. Meaningful variable names and prompts applied. Class names are written in UpperCamelCase. Variable names are written in lowerCamelCase. Constant names are in written in All Capitals. Braces use K&R style. Declare all instance variables private. Avoids the duplication of code.

Custom Paper Help
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.