Java program Please just create two classes as it is stated on the instructions
ID: 3883658 • Letter: J
Question
Java program
Please just create two classes as it is stated on the instructions
You goal in this project is to create a simple Java project using the NetBeans IDE. The project should create a simple information page (not complete in any away) about the diabetes patient. The output should be something like this To create the project in an OOP manner, create two classes, one called Person and the other is called profile. The first class should have the top part of the form as its members, and the second class should have the bottom part. Your main class should instantiate two objects and fill in the information for one patient.Explanation / Answer
import java.lang.*; import java.util.*; class Person { long pid; String nm; String add; public void read1() { Scanner sc = new Scanner(System.in); System.out.println("Enter Patient Id :"); pid = sc.nextLong(); System.out.println("Enter Patient Name :"); nm = sc.next(); System.out.println("Enter Patient Address:"); add = sc.next(); } void display1() { System.out.println("Patient ID : "+pid); System.out.println("Name: "+nm); System.out.println("Address : "+add); } }; class profile extends Person { int weight,height; float temp; String pressure; String smoking,drinking; int excer; public void read() { read1(); Scanner sc = new Scanner(System.in); System.out.println("Enter Patient weight:"); weight = sc.nextInt(); System.out.println("Enter Patient Height:"); height = sc.nextInt(); System.out.println("Enter Patient temperature:"); temp = sc.nextFloat(); System.out.println("Enter Patient Pressure:"); pressure = sc.next(); System.out.println("Smoking Habit[ None / Yes] "); smoking = sc.next(); System.out.println("Drinking Habit "); drinking = sc.next(); System.out.println("How many times an excersice per a Week :"); excer = sc.nextInt(); } void display() { display1(); System.out.println("Patient Medical Profile"); System.out.println("Weight : " + weight); System.out.println("Height : " + height + " Temperature : "+temp+" Pressure :"+pressure); System.out.println("Smoking : "+smoking+" Drinking : "+drinking+" Excercise : "+excer+" times a week"); } }; class Demo { public static void main(String []args) { profile obj = new profile(); obj.read(); obj.display(); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.