when printing Weigh no value shows up code public class HealthProfile { private String _FirstName; private String _LastName; private int _BirthYear; private double _Height; private double _Weigth; private int _CurrentYear; public HealthProf

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

C# problem 

when printing Weigh no value shows up

code

public class HealthProfile
{
private String _FirstName;
private String _LastName;
private int _BirthYear;
private double _Height;
private double _Weigth;
private int _CurrentYear;

public HealthProfile(string firstName, string lastName, int birthYear, double height, double weigth, int currentYear)
{
_FirstName = firstName;
_LastName = lastName;
_BirthYear = birthYear;
_Height = height;
_Weigth = weight;
_CurrentYear = currentYear;
}

public string firstName { get; set; }
public string lastName { get; set; }
public int birthYear { get; set; }
public int height { get; set; }
public double weight { get; set; }
public int currentYear { get; set; }


public int Person_Age
{
get { return _CurrentYear - _BirthYear; }
}

public double Height
{
get { return _Height; }
}

public double Weight
{
get { return Weight; }
}

public int Max_Heart_Rate
{
get { return 220 - Person_Age; }
}

public double Min_Target_Heart_Rate
{
get { return Max_Heart_Rate * 0.65; }
}

public double Max_Target_Heart_Rate
{
get { return Max_Heart_Rate * 0.75; }
}

public double BMI
{
get {return (_Height / (Math.Pow(_Height, 2))) *703;}
}

public string BMIEvaluation()
{
if (BMI < 18.5)
return "Underweight";
else if (BMI < 25)
return "Normal";
else if (BMI < 30)
return "Overweight";
else
return "Obese";
}


public void DisplayPatientRecord()
{
Console.WriteLine($"|--------------------------------------------------------|");
Console.WriteLine($"| Patient Health Record |");
Console.WriteLine($"|--------------------------------------------------------|");
Console.WriteLine($"| {"Employee Name",-21} | {_LastName + ", " + _FirstName,-30} |");
Console.WriteLine($"| {"Patient Birth Year",-21} | {_BirthYear,30:D} |");
Console.WriteLine($"| {"Patient Age:",-21} | {Person_Age,30:D} |");
Console.WriteLine($"| {"Height",-21} | {_Height,30:F} |");
Console.WriteLine($"| {"Weight",-21} | {_Weigth,30:F} |");
Console.WriteLine($"| {"Maximum Heart Rate",-21} | {Max_Heart_Rate,30:F} |");
Console.WriteLine($"| {"Target Heart Rate",-21} | {(Min_Target_Heart_Rate + " - " + Max_Target_Heart_Rate),31:F}|");
Console.WriteLine($"| {"BMI",-21} | {BMI,30:F} |");
Console.WriteLine($"| {"BMI Text Value",-21} | {BMIEvaluation(),30} |");
Console.WriteLine($"|--------------------------------------------------------|");

}
}
}
 main

static void Main(string[] args)
{
HealthProfile heartRate = new HealthProfile("Jessie","May",1977, 66.5 ,165.5, 2021 );
heartRate.DisplayPatientRecord();
}

 

Patient Health Record
| Employee Name
| Patient Birth Year
| Patient Age:
| Height
| Weight
| Maximum Heart Rate
| Target Heart Rate
| BMI
| BMI Text Value
| May, Jessie
1977 |
|
ו 44
66.50
0.00 |
176.00 ||
114.4 - 132|
10.57 |
Underweight |
|-
---- |
Transcribed Image Text:Patient Health Record | Employee Name | Patient Birth Year | Patient Age: | Height | Weight | Maximum Heart Rate | Target Heart Rate | BMI | BMI Text Value | May, Jessie 1977 | | ו 44 66.50 0.00 | 176.00 || 114.4 - 132| 10.57 | Underweight | |- ---- |
Expert Solution
Step 1

The problem is due to name resolution in the constructor,when we change it this it will work

  _Weigth = wt;

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY