[SOLVED] CSC221 Homework1-Steps in a mile

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon HW-1-eqixuq.zip (403.6 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (2 votes)

How many steps in a mile?

A steps‐to‐miles calculator determines the distance a person should walk in order to attain a specific number of steps. The formula is specific to every person and should be based on the length of their stride. A person’s stride is calculated based on their gender, height, and whether they are walking or running.

For this assignment we will implement a very simple walking steps to miles calculator using the formulas provided next.

Disclaimer: this assignment is only meant as a programming assignment and is not meant for any other purposes. Note:Β 

  • this is an individual assignment; please do your own work, sharing and/or copying code and/or solution ideas with/from others will result in a grade of 0 and disciplinary actions for all involved parties. If you run into problems and have done your best to solve them, please contact me before/after class or by e-mail.
  • A 20% grade deduction for every day the assignment is late.

Assignment’s Requirements:

  1. Program should compile and run in order to be graded
  2. You must use π‘†π‘‘π‘Ÿπ‘–π‘›π‘” π‘“π‘œπ‘Ÿπ‘šπ‘Žπ‘‘π‘‘π‘’π‘Ÿπ‘  𝑖. 𝑒. π‘π‘Ÿπ‘–π‘›π‘‘π‘“ … for ALL output statements. Your solution should NOT contain the methods π‘π‘Ÿπ‘–π‘›π‘‘ OR π‘π‘Ÿπ‘–π‘›π‘‘π‘™π‘› .
  3. You should not need any 3rd party libraries (i.e. libraries besides Java’s API). If you think some libraries maybe useful, please check with me first.
  4. Comment your code:
    1. Javadoc comments for the class
    2. Javadoc comments for each of the class’ members (variables and methods)
    3. Comments for major steps in your code
  5. Submit two separate classes each in its own JAVA file. Please use Blackboard’s upload feature and don’t submit your compiled code or LINKS to online editors.
    1. π‘†π‘‘π‘’π‘π‘ π‘‡π‘œπ‘€π‘–π‘™π‘’π‘  – a container and operations class for the calculator. Follow the names shown in the UML diagram in Figure 1 exactly. I use a test script to examine your code which fails if you do not follow the naming convention.
    2. π‘‡π‘’π‘ π‘‘π‘†π‘‘π‘’π‘π‘ π‘‡π‘œπ‘€π‘–π‘™π‘’π‘  – This class contains the main method to perform unit testing on the previous class.

Class π‘Ίπ’•π’†π’‘π’”π‘»π’π‘΄π’Šπ’π’†π’”:

  1. Four variables: π‘›π‘Žπ‘šπ‘’ (String), 𝑓𝑒𝑒𝑑 (double), and π‘–π‘›π‘β„Žπ‘’π‘  (double).
  2. Default π‘π‘œπ‘›π‘ π‘‘π‘Ÿπ‘’π‘π‘‘π‘œπ‘Ÿ to initialize the variables to their default values – null for strings and ‐1 for numeric.
  3. π‘π‘œπ‘› π‘‘π‘’π‘“π‘Žπ‘’π‘™π‘‘ constructor to initialize the variables using the constructor’s parameters.
  4. π΄π‘π‘π‘’π‘ π‘ π‘œπ‘Ÿπ‘  (setters) and π‘šπ‘’π‘‘π‘Žπ‘‘π‘œπ‘Ÿπ‘  (getters) methods for all four variables – 6 methods in total.
  5. β„Žπ‘’π‘–π‘”β„Žπ‘‘_π‘–π‘›π‘β„Žπ‘’π‘  returns the height in inches. Conversion: 1𝑓𝑑 Β Β Β Β  Β 12 π‘–π‘›π‘β„Žπ‘’π‘ 
  6. π‘ π‘‘π‘Ÿπ‘–π‘‘π‘’πΏπ‘’π‘›π‘”π‘‘β„Ž_π‘–π‘›π‘β„Žπ‘’π‘  returns the length of a person’s stride. Remember to invoke the previous method:
    • π‘ π‘‘π‘Ÿπ‘–π‘‘π‘’ β‰ͺ β„Žπ‘’π‘–π‘”β„Žπ‘‘_π‘–π‘›π‘β„Žπ‘’π‘  ≫ Β Β Β Β Β  413
  7. π‘šπ‘–π‘™π‘’π‘  𝑠𝑑𝑒𝑝𝑠 returns the number of miles to walk given the desired number of steps. Remember to invoke the previous methods:
    • π‘šπ‘–π‘™π‘’π‘ 
  8. π‘π‘’π‘Ÿπ‘Ÿπ·π‘Žπ‘‘π‘’ returns today’s date as a String. One way is to use Java’s πΊπ‘Ÿπ‘’π‘”π‘œπ‘Ÿπ‘–π‘Žπ‘›πΆπ‘Žπ‘™π‘’π‘›π‘‘π‘Žπ‘Ÿ to first extract the π‘€π‘œπ‘›π‘‘β„Ž, π·π‘Žπ‘¦, π‘Œπ‘’π‘Žπ‘Ÿ values, then build a string representing today’s date. https://docs.oracle.com/javase/8/docs/api/java/util/GregorianCalendar.html)
  9. π‘“π‘œπ‘Ÿπ‘šπ‘Žπ‘‘π΄π‘ π‘†π‘‘π‘Ÿπ‘–π‘›π‘”: receives one input for the numbers of steps and formats and returns the class’ members as a multi‐line string. Use the String format method to format and return the values as shown in Figure 2.
  • All leading labels should have column widths of 13 characters
  • All floating‐point numbers have precision 2 and the thousands comma (i.e. decimal separator)

Class π‘»π’†π’”π’•π‘Ίπ’•π’†π’‘π’”π‘»π’π‘΄π’Šπ’π’†π’”:

  • Remember to show a message string before each prompt and use π‘π‘Ÿπ‘–π‘›π‘‘π‘“ ONLY
  1. Create an instance of class π‘†π‘‘π‘’π‘π‘ π‘‡π‘œπ‘€π‘–π‘™π‘’π‘  using the π‘‘π‘’π‘“π‘Žπ‘’π‘™π‘‘ Use the mutator methods to assign values to the class’ private members. See Figure 2 for a sample test.
  2. Prompt the user to enter a π‘›π‘Žπ‘šπ‘’ and β„Žπ‘’π‘–π‘”β„Žπ‘‘ in 𝑓𝑒𝑒𝑑 and π‘–π‘›π‘β„Žπ‘’π‘ . See Figure 2 for a sample test. These values will be used in the next step.
  3. Create a second instance of π‘†π‘‘π‘’π‘π‘ π‘‡π‘œπ‘€π‘–π‘™π‘’π‘  using the non‐default Use the values entered in the previous step.
  4. Using π‘π‘Ÿπ‘–π‘›π‘‘π‘“ :
    1. Using the 1st instance, print today’s as shown in Figure 2
pass the value 12345
  1. Using the 1st instance, print the results of calling the function π‘“π‘œπ‘Ÿπ‘šπ‘Žπ‘‘π΄π‘ π‘†π‘‘π‘Ÿπ‘–π‘›π‘”, for the steps parameter.
pass the value 1000
  1. Using the 2nd instance, print the results of calling the function π‘“π‘œπ‘Ÿπ‘šπ‘Žπ‘‘π΄π‘ π‘†π‘‘π‘Ÿπ‘–π‘›π‘”, for the steps parameter.
  • HW-1-eqixuq.zip