Starting from:
$35

$29

Programming Assignment #1 Solution

Install your most preferred Java IDE, and implement textbook (9/E) problem 3.16 in page 101. The problem statement is reproduced next:




3.16 (Target-Heart-Rate Calculator) While exercising, you can use a heart-rate monitor to see that your heart rate stays within a safe range suggested by your trainers and doctors. According to the American Heart Association (AHA), the formula for calculating your maximum heart rate in beats per minute is 220 minus your age in years. Your target heart rate is a range that's 50-85% of your maximum heart rate. Note: These formulas are estimates provided by the AHA. Maximum and target heart rates may vary based on the health, fitness and gender of the individual. Always consult a physician or qualified health care professional before beginning or modifying an exercise program.




Create a class called HeartRates. The class attributes should include the person's first name, last name and date of birth (consisting of separate attributes for the month, day and year of birth). Your class should have a constructor that receives this data as parameters. For each attribute provide set and get methods. The class also should include a method that calculates and returns the person's age (in years), a method that calculates and returns the person's maximum heart rate and a method that calculates and returns the person's target heart rate. Write a Java application that prompts for the person's information, instantiates an object of class HeartRates and prints the information from that object—including the person's first name, last name and date of birth—then calculates and prints the person's age in (years), maximum heart rate and target-heart-rate range.




Requirements




Realize your implementation that satisfies the following minimal requirements:




2 pt: properly exhibits right logic, i.e., readable and compilable coding







2 pt: properly reads personal information from terminal







2 pt: properly writes maximum and target heart rates to terminal







2 pt: properly writes error message to terminal in response to incorrect input







extra credit: properly interfaces with dialog boxes (see 3.19)







Look at the 3rd implementation of this which is simplest for date validation.




Submission




You are to hand in your development by Wednesday 18:00 P.M. February 13th, i.e., just before the lecture. Once you have done all your work, email me your zipped project file or Java source file(s). You can submit your work by Friday 18:00 P.M. February 15th (with 25% score deduction).







Section P




Name
Email
Oren Ben-Meir
obenmei000@citymail.cuny.edu
Wei-Cheng Lin
wlin010@citymail.cuny.edu
Phuc Nguyen
pnguyen001@citymail.cuny.edu
Mohammed


Bhuiyan
mohammedbhuiyan73@gmail.com
Afsana Akter
aakter002@citymail.cuny.edu
Tenzin Sherper
tsherper000@citymail.cuny.edu
Kevin Chen
kchen008@citymail.cuny.edu
Arman Uddin
auddin004@citymail.cuny.edu
Farhan Zaman
fzaman2258@gmail.com
Arham Chowdhoury
achowdh010@citymail.cuny.edu
Abusaleh Masud
amasud17@hotmail.com
Abtahi Chowdhury
abtahichowdhury@gmail.com



https://mail.google.com/mail/u/0?ik=71e475cfef&view=pt&search=all&permmsgid=msg-f%3A1624238362188222806&simpl=msg-f%3A162423836218… 1/2

More products