تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
The Question
Create a java project and make the name of it as your group's name. Inside the project,
create a class called PatientSugar with these fields:
⚫patientId "int"
patientName "String"
⚫bloodSugar "array of int"( taking into consideration that the blood sugar is an int value)
⚫numInstntitd"int". This to keep tracking the number of instantiated objects from the
class.
*NOTE: you should choose the best modifier when declaring the fields.
The class should contain these methods:
A method avgSugar (int[] sugar) that returns the average of Blood Sugar.
A method display() that displays the patient information.
A method toFile(String fileName) that writes patient information,the average of the
Blood sugar, and the current date (Use Java date class).
A method that displays the count of the instantiated objects from PatientSugar class.
In addition, create the main() method that does the following functionalities (the main()
method should be written inside the class that has your group's name):
•Create an object from PatientSugar class.
Prompt the user to insert the information (Patient Id, Patient name, and Blood sugar of 3
tests). The user insertion should be stored in the instantiated object.
Display Patient information by invoking display ( ).
Display how many times the object was instantiated by invoking the method from the
PatientSugar class.
⚫Test your project using your group members names. At the end, we expect to have 3 text
files containing a group member's name, average and date in each file. This should be done
through invoking toFile(String fileName) method and the member's name should be passed
to the method as a fileName.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.