Programming Fundamentals Accelerated (3 CR)
PA2 - Feel the Burn, Part 2!
Software Requirements Specification
Code due Wednesday, Oct 2, by 11:59pm - in WebCAT
Other subparts will have other deadlines
UPDATE: 09/27/2013 - The nature of testing of DukeFitIO makes it difficult for you at this point to be able to write your own tests. I have provided a test file which you can use for testing, but you should also submit it to WebCAT as part of your zipped package. You will need to submit both DukeFit and DukeFitIO along with the test I provide and your own test for DukeFit.
Introduction
Purpose: You have written DukeFit, but now have some new tools and techniques. Also, your organization has decided that the old DukeFitIO class needs to be rewritten. You have been assigned the task of "refactoring" this application.
The Formulas (This has not changed) (from FitNowTraining.com):
Men use the following formula:
Calories Burned = [(Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) -55.0969] x Time / 4.184.
Women use the following formula:
Calories Burned = [(Age x 0.074) - (Weight x 0.05741) + (Heart Rate x 0.4472) - 20.4022] x Time / 4.184.
Objectives - At the conclusion of this exercise the student will demonstrate that they can:
- Divide a large problem up into small problems.
- Create an application that uses methods for the small problems.
- Create a test suite to "exercise" each method in the program.
- Do everything necessary to create, debug, and run a Java program.
- Use comments to delineate each section of the program.
- Adhere to a Style Guide.
- READ AND FOLLOW DIRECTIONS!!!!!
Deadlines
- Part A: See Canvas:September 27, no later than 11:59pm. (Worth 25% of the assignment grade)
- Part B: WebCAT:October 2, no later than 11:59pm. (Worth 65% of the assignment grade)
- Part C: See Canvas: October 4, no later than 11:59pm. (Worth 10% of the assignment grade)
The Parts
Part A - Understanding the problem- See Canvas for detail
In this part of the assignment, you will demonstrate that you can test a method in isolation and develop test cases.
Part B - Writing the code - See the Part B module for the details about this section
You will be rewriting your code from PA1 and writing the code that was given to you in PA2. You will test your code using the test cases built in Part A and will submit your program to WebCAT along with those test cases. . Your program must conform to all StyleGuide requirements for this class. 80% of the points for this part will come from correctly passing our reference tests and 20% will come from the conformance to style.
Part C - Reflecting on your work - See Canvas for detail
You will consider the process of building your program and think about ways of doing it better the next time. In this segment you will also need to answer a few questions about the program and techniques that you used.
Program Structure
You are a part of a team of programmers working on this application. You are maintaining two programs. One is called DukeFitIO and will be rewritten from scratch.
You will rewrite the class containing the main method. It must be called DukeFit.java.
Specific structure (Your program must conform to these method signatures). You may add additional private methods should you choose to do so. Recall from the Style Guide that no method may be longer than 25 statements. (This excludes white space and comments.) Each method must address the requirements listed below.
DukeFitIO
All methods must be non-static.
- You must have a method, enterAge, that has no parameters and returns an integer value. It must prompt for the age and return the value that the user enters.
- You must have a method, enterWeight, that has no parameters and returns a double value. It must prompt the user for the weight and returns the value that the user enters.
- You must have a method, enterHeartRate, that has no parameters and returns an integer value. It must prompt the user for the rate and returns the value that the user enters.
- You must have a method, enterTime, that has no parameters and returns an integer value. It must prompt the user for the rate and return the value that the user enters.
- You must have a method, outputMen, that takes in a double parameter and prints the required output line for men. (Note: in the prior version you did the formatting in DukeFit. This version will have you do it here.
- You must have a method, outputWomen, that takes in a double parameter and prints the required output line for women.
DukeFit
- You must have a main method that can be called by the command line as described below.
- You must have a method calcMen that takes in the four values from the input (in the input order) and returns the unformatted calorie value based on the above formula for men.
- You must have a method calcWomen that takes in the four values from the input (in the input order) and returns the unformatted calorie value based on the above formula for women.
- Any constants that you define must be defined within each of the methods.
Application Behavior
- Your application must prompt the user for each of the 4 input values in the following order using the following prompts. (NOTE: The last version also required a new line character following the read, but that should not be done in this version. Simply output the prompt and read the corresponding value.)
- Age (as an integer) - "Enter the person's age: "
- Weight (as a double) - "Enter the person's weight: "
- Heart rate (as an integer) - "Enter the person's heart rate: "
- Duration (as an integer) - "Enter the duration of the activity: "
- Your program must calculate the calories for both men and women.
- Your program must the output the values as follows:
- A blank line separating the input from the output.
- A line reading " Men: " followed on the same line by the Men's calories rounded to 2 decimal places.
- A line reading "Women: " followed on the same line by the Women's calories rounded to 2 decimal places.
- A single new line character must end each line of output.
You must be able to launch the application by calling the command java DukeFit from the command line.
Output and Error Handling
You do not need to be concerned about Error Handling and should assume that only valid values are entered for each of the prompts.
Testing
Based on the lab from Monday Sept 23, you must build a test suite that will exercise your program. Use this file for DukeFitIOTest.java. DukeFitIO.java It will run each of the methods in DukeFitIO.java, but will not test any results. This file will enable you to pass "coverage" tests in WebCAT.
For DukeFit, you should build a tester DukeFitTest.java. You should test your calculateMen and calculateWomen method passing at least 3 different values. If you create a format method, you must also test it. Your program will be assessed both by the completeness of coverage of your code (all lines should be executed) and by your conformance to the reference tests that the instructor provides.
Additional Application Requirements
- Any additional methods that you add should be made private. (There is no need in this program to add methods.)
- Your program must conform to standard Java programming standards and the additional standards for this class. See the Style Guide for your class.
- You should, for your own benefit, write a tester that will test the various methods that you are building and the classes that you are using.
- You are required to submit a tester program. All testing will be done by the instructor reference tests.
Honor Code
This work must conform to the JMU Honor Code and the specific requirements of this class. NO help may be provided by any student to another student. Authorized help is limited to your textbook, the TAs for any CS139, CS149, or CS159 section, and the professor for your section. Be sure to acknowledge any help that you do receive from a TA. See collaboration policy.
Grading
- Your program will be evaluated both on its correctness and conformance to the required Style elements.
- You will achieve a grade of 80 points for a program that runs correctly and produces exactly the required output in the required format on time.
- The remainding 20 points will be based on your conformance to the Style Guide and other requirements of the assignment. Review the Style Guide before submitting your program and the grade sheet which is produced by the submit system.
- All grades will be based on 100 points.
- You may submit any number of times. The only one I will count is the one that corresponds to the hardcopy report that you turn in.
- The hardcopy that you turn in will be the formatted version that I will check. Make sure it has no line wraps or other spacing issues.
- Successfully submitted programs that are late will be graded, then the late penalty is assessed for each day late according to the following schedule.
For submissions after the deadline, there will be a 10 point per day late penalty. Saturday will not count as a day. No submissions will be accepted after Tuesday October 15.
HINTS
- A model solution will be provided after the last late day.
Last updated: 09/23/2013