Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code using Java. Put all 4 classes in one file. Make it as simple to understand. Thank you. Objective: Classes and Objects, Composition classes,

Please code using Java. Put all 4 classes in one file. Make it as simple to understand. Thank you.

Objective: Classes and Objects, Composition classes, Strings, Enumeration data types and Text files.

Use,

import java.util.Scanner; import java.io.IOException; import java.io.File;

image text in transcribed

image text in transcribed

While exercising, you can use a heart-rate monitor to see that your heart rate stays within range suggested by the trainers and doctors. The formula to calculate your maximum heart rate per minute is 220 (magic number) minus your age in years. Your target heart rate is a range that's 50 to 85% of your maximum heart rate. Let us explore the following UML diagram: HeartRates String firstName, Sorina las Name. Date dobit cuentran cenumeration Month A Jan A Fet A Mar A Apr Heartitates Test May A Jun A static void main(szindards Aug 4 Sep 4 Oct A NON A Dec HeartRates 21.1 ..1 G-String firstName morim 11 -String lastName -Date dob Date -int currentYear int day - Month month Int year -HeartRates HeartRates he) String getFirstNameo Date void setFirsWarnerString firstName) Atring gollastName Datent day, Month month, intyear) +Date Date void setName(string lastName) + int geDayo 1.1 Dale getDOBO void setDODD dob) + Month gelontho +inf geluaro int cetCurrenter void setCurrentYearint currentYear) +void setDatent day, Month month, intyes) -intatage -int celarimum HeartRated douale getinin Targelheart -double geanimumTargetHeartRate void printinfo den Design 4 classes An enumeration Month class A Date class. Note that other than the usual information for a calendar date (day. month, and year), you have constructors, accessor and mutator methods. For the default constructor, initialize the date to 15 January 2021. A Heart Rate class has the same features as the Date class (constructors, accessor and mutator methods). You include also a few important methods related to the class, for example, get the maximum heart rate method, get the minimum and the maximum of the targeted heart rate, and a method to print out an object of this class. You construct a text file (using text editor, for example notepad) to store two persons profiles. The sample format of this text file is: Ah Beng Tan 15 Oct 1988 2018 Robert Richard Wong 31 Dec 2005 2018 In the main method (defined in another class), try to read the information from the above text file and display the following output: Name: Ah Beng, Tan Date of birth: 15 Oct 1988 Current year: 2018 Your age: 38 years old Clinic analysis, base on your age: 1. Your maximum heart rate is 192 2. Your minimum target heart rate is 95.00 3. Your maximum target heart rate is 161.50 Name: Robert Richard, Wong Date of birth: 31 Dec 2005 Current year: 2018 Your age: 13 years old Clinic analysis, base on your age: 1. Your maximum heart rate is 207 2. Your minimum target heart rate is 193.58 3. Your maximum target heart rate is 175.95

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

How is the NDAA used to shape defense policies indirectly?

Answered: 1 week ago