-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPatientTest.java
142 lines (142 loc) · 3.31 KB
/
PatientTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import java.util.*;
import java.lang.*;
import java.io.*;
class PatientTest
{
// Variables Area
String last;
String first;
String comments;
String visited;
int age;
int ID;
double height;
double weight;
double BMI;
char sex;
// Constructor Area
PatientTest(int ID, String first, String last, String visited, char sex, int age, double height, double weight, String comments)
{
this.ID=ID;
this.first=first;
this.last=last;
this.visited=visited;
this.sex=sex;
this.age=age;
this.height=height;
this.weight=weight;
this.comments=comments;
this.BMI=BMI;
}
//methods area
int getID()
{
return ID;
}
public String getFirst()
{
return first;
}
public String getLast()
{
return last;
}
public String getVisited()
{
return visited;
}
public char getSex()
{
return sex;
}
public int getAge()
{
return age;
}
public double getHeight()
{
return height;
}
public double getWeight()
{
return weight;
}
public String getComments()
{
return comments=comments;
}
public double getBMI()
{
BMI = weight/(height*height);
return BMI;
}
public void setID(int newID)
{
ID=newID;
}
public void setfirst(String newfirst)
{
first=newfirst;
}
public void setlast(String newlast)
{
last=newlast;
}
public void setvisited(String newvisited)
{
visited=newvisited;
}
public void setsex(char newsex)
{
sex=newsex;
}
public void setheight(double newheight)
{
height=newheight;
}
public void setage(int newage)
{
age=newage;
}
public void setweight(double newweight)
{
weight=newweight;
}
public void setComments(String newcomments)
{
comments=newcomments;
}
public void display()
{
System.out.println("National Health ID: " +ID);
System.out.println("First name : " +first);
System.out.println("Last name: " +last);
System.out.println("Last date the patient visited: " +visited);
System.out.println("Sex: " +sex);
System.out.println("Age: " +age);
System.out.println("Height: " +height);
System.out.println("Weight: " +weight);
System.out.println("Comments: " +comments);
System.out.print("BMI : "+BMI+ " and ");
if(BMI<18)
{
System.out.println("you are under-weight!");
}
else if ((18<BMI)&&(BMI<28))
{
System.out.println("you are normal!");
}
else if((28<BMI)&&(BMI<30))
{
System.out.println("you are over-weight!");
}
else
{
System.out.println("you are obese!");
}
}
public String toSort()
{
return this.ID+" "+this.first+" "+this.last+" "+this.visited+" "+this.sex+" "+this.age+" "+this.height+" "+this.weight+" "+this.comments+" "+this.BMI;
}
}