Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming Exercise 2: Computerization of Health Records) A health care issue t

ID: 3746898 • Letter: P

Question

Programming Exercise 2: Computerization of Health Records) A health care issue that has been in the news lately is the computerization of health records. This possibility is being approached cautiously because of sensitive privacy and security concerns, among others. [We address such concerns in later exercises.] Computerizing health records could make it easier for patients to share their health profiles and histories among their various health care professionals. This could improve the quality of health care, help avoid drug conflicts and erroneous drug prescriptions, reduce costs and, in emergencies, could save lives. In this exercise, you'll design a "starter" HealthProfile class for a person. The class attributes should include the person's first name, last name, gender, date of birth (consisting of separate attributes for the month, day and year of birth), height (in inches) and weight (in pounds). Your class should have a constructor that receives this data. For each attribute, provide set and get methods. The class also should include methods that calculate and return the user's age in years, maximum heart rate and target-heart-rate range (see Exercise 3.16), and body mass index (BMI; see Exercise 2.33). Write a Java application that prompts for the person's information, instantiates an object of class HealthProfile for that person and prints the information from that object including the person's first name, last name, gender, date of birth, height and weight then calculates and prints the person's age in years, BMI, maximum heart rate and target heart-rate range. It should also display the BMI values chart from Exercise 2.33

Explanation / Answer

Hi student,As you asked the code in C# i am submitting it.THe driver class to test the code is in seperate class named Program.cs

----------------------------------------------------

//Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HealthProfile
{
class HealthProfile
{
//Private fields or attributes
private string _firstName;
private string _lastName;
private string _gender;
private int date_DOB;
private int month_DOB;
private int year_DOB;
private double height;
private double weight;

//Constructor to initialize the object
public HealthProfile(string _firstName, string _lastName,
string _gender, int date_DOB, int month_DOB, int year_DOB,
double height, double weight)
{
this.FirstName = _firstName;
this.LastName = _lastName;
this.Gender = _gender;
this.Date_DOB = date_DOB;
this.Month_DOB = month_DOB;
this.Year_DOB = year_DOB;
this.Height = height;
this.Weight = weight;
}

public override string ToString()
{
return "Person's Name is " + _firstName + " " + _lastName + " " +
"Gender is :" + _gender + " " +
"Date of birth is :" + date_DOB + "/" + month_DOB + "/" + year_DOB + " "
+ "Height is :" + height + "Inches " + "And weight is " + weight + "Pounds";
}
//Property for private fields
public string FirstName
{
get
{
return _firstName;
}

set
{
_firstName = value;
}
}

public string LastName
{
get
{
return _lastName;
}

set
{
_lastName = value;
}
}

public string Gender
{
get
{
return _gender;
}

set
{
_gender = value;
}
}

public int Date_DOB
{
get
{
return date_DOB;
}

set
{
date_DOB = value;
}
}

public int Month_DOB
{
get
{
return month_DOB;
}

set
{
month_DOB = value;
}
}

public int Year_DOB
{
get
{
return year_DOB;
}

set
{
year_DOB = value;
}
}

public double Height
{
get
{
return height;
}

set
{
height = value;
}
}

public double Weight
{
get
{
return weight;
}

set
{
weight = value;
}
}

//method is used to calculate age of person
public int Age()
{
return (DateTime.Now.Year - this.Year_DOB);
}

//The heart rate range is depend on Age
public string Heart_Rate_Range()
{
string range = " ";
if(Age()<41)
range = "The heart rate range is is 90 to 153 /n and maximum is 180 for normal people";
if (Age() >40&&Age()<46)
range = "The heart rate range is is 88 to 149 /n and maximum is 175 for normal people";
else
range = "The heart rate range is is 85 to 145 /n and maximum is 170 for normal people";
return range;
}

//Method to calculate Body mass index
public double BMI()
{
//the formula to calculate Body Mass Index is
//weight inpounds *703 divide by heght in inches's square
double result = weight * 703 / (height * height);
return result;
}
}
}

//Second class the driver class

namespace HealthProfile
{

//The driver class to enter the data
class Program
{
static void Main(string[] args)
{
//Collect Person Data from Console.
Console.WriteLine("Welcome to Health Care Application");
Console.WriteLine("Please enter First Name");
string fn = Console.ReadLine();
Console.WriteLine("Please enter Last Name");
string ln = Console.ReadLine();
Console.WriteLine("Please enter Gender");
string gn = Console.ReadLine();
Console.WriteLine("Please enter Birth Date (Integer value)");
int date = 0;
int.TryParse(Console.ReadLine(),out date);
Console.WriteLine("Please enter Birth Month(Integer value)");
int month = 0;
int.TryParse(Console.ReadLine(), out month);
Console.WriteLine("Please enter Birth Year(Integer value)");
int year = 0;
int.TryParse(Console.ReadLine(), out year);
Console.WriteLine("Please enter Height in Inches");
double height = 0;
double.TryParse(Console.ReadLine(), out height);
Console.WriteLine("Please enter Weight in Pounds");
double pounds = 0;
double.TryParse(Console.ReadLine(), out pounds);

//Instantiate HealthProfile class
HealthProfile hf = new HealthProfile(fn, ln, gn, date, month, year, height, pounds);

Console.WriteLine("Hii User {0} Created Successfully", hf);
Console.WriteLine("The Age of {0} is {1}", hf.FirstName, hf.Age());
Console.WriteLine( hf.Heart_Rate_Range());
Console.WriteLine("The BMI of {0} is {1}",hf.FirstName,hf.BMI());
}
}
}