I have tried another exercise, but again I will need help, here's the code
hi,
I have another problem. here's the question pluss the code.
public interface Patient{
public void doVisit(float hour);
public boolean hospitalize();
1. I will need to write a class name OrdinaryPatient which extends Patient.
the class will include value int that his name age and another value that will be boolean
of disease.
I have to do two constructors. one that don't get values and give them default and the other one
that does get values.
another method name docVisit which get a visit to the doctor time visit and will print a message.
the method hospitalize will hospitalize the patient (and if he will have disease he will get true).
and for age I have to write methods of get and set.
2. I will need to write a class of Hipochondriac that extends from OrdinaryPatient.
I have to do two constructors. one that don't get values and make default and the other one that do get values.
I will need to ade int by the name of numberOfHospitalize.
I will need to move the method hospitalize that it will be possible to hospitalize the hypochondriac
on with the value numberOfHospitalize that his small from 5 and if he will hospitalize he will return
the value true.
3. write class PatientClass which will be the method main.
do 10 objects from OrdinaryPatient, 5 that don't get values and 5 will get randomaly age and
chronic disease with true.
do 10 objects from Hipochonidraic, 9 that don't get values and one get all of them.
save all objects in value from Patinet.
print for each of them their age.
print for the OrdinaryPatient alone the method of Hospitalize.
ok, here's what I did.
1. OrdinaryPatient
pbulic class OrdinaryPatient implements Patient{
private int age;
private boolean disease;
public OrdinaryPatient(){
this.disease=false;
this.age=0;
public OrdinaryPatient(int age,boolean ddisase){
this.disease=disease;
this.age=age;
public int getAge(){
return age;
public void setDisease(boolean disease){
this.disease=disease;
public void setAge(int age){
this.age=age;
public void docVisit(){
System.out.println("Patient's visit is one hour");
public boolean hospitalize(){
return false;
2. public class Hipochondriac extends OrdinaryPatient{
private = numberOfHospitalize;
public Hipochondriac();
super();
numberOfHospitalize=0;
public Hipochondriac(int age, boolean diseased, int numberOfHospitalize){
super(age.diseased);
setnumberOfHospitalize(numberofHospitalize);
from here I don't know how to continue.
3. public class PatientClass{
public static void main(String args[]){
patient patinets= new patient[20];
for (int i=0; i<5; i++){
patients= new OrdinaryPatient();
from i'm stuck!!!
if you can help me to improve it I will appriciate it...
Einat
here my result.
1. public interface Patient{
public void docVisit(float hour_;
public boolean hospitalize();
public class OrdinaryPatient extends Patient
private int age;
private boolean disease;
//constructors
public OrdinaryPatient(){
age=20;
disease=true;
public OrdinaryPatient(int age, boolean disease) {
setAge(age);
this.disease=disease;
//methods
public int getAge() {
return age;
public void setAge(boolean disease) {
if(age>0 && age<120)
this.age=age;
//overriding methods.
public void docVisit(float hour) {
System.out.println("your visit turn is at "+hour");
public boolean hospitalize(){
System.out.println("go to hospital");
if(disease)
return true;
else
return false;
2. public class Hipochondriac extends OrdinaryPatient{
private int numberOfHospitalize;
//constructors
public Hipochondriac(){
public Hipochondriac(int age, boolean disease, int numberOfHospipitalize){
setAge(age);
this.disease=disease;
this.numberOfHospitalize=numberOfHospitalize
//methods
public int getNumberOfHospitalize(){
return numberOfHospitalize;
public void setNumberOfHospitalize(int numberOfHostpitalize){
if(numberOfHospitalize>0)
this.numberOfHospitalize=numberOfHospitalize;
public boolean hospitalize(){
if(numberOfHospitalize<5)
System.out.println("go to hospital");
numberOfHospitalize++;
return true;
else
return false;
3. public class PatientClass
//constructors
private PatientClass(String[] args){
//private methods helps to build the object.
intialArr(args);
printAge();
gotHospital();
//methods.
private void intialArr(String[] args){
int i;//array index
for(i=0;i<arr.lents/2;i+=2)
arr=new OrdinaryPatient();
arr[i+1]=new OridnaryPatient((int)(Math.random()*121),true);
for(;i<=arr.length-2;i++)
arr[i]=new Hipochondriac();
arr[i]=new Hipochondriac(Interget.parseINt(args[0]),
private void printAge(){
for(int i=0;i<arr.length;i++)
System.out.println(((OrdinaryPatient)arr[i]).getAge());
private void gotoHospital(){
for(int i=0;i<arr.length;i++)
//checking for ordinarypatient objects only
if(!(arr[i] instanceof Hipochondriac))
//dont need casting
arr[i].hospitalize()[
//main method
public static void main(String[] args)
//setting the commandLine array from the main to PatientClass object
PatientClass pc=new PatientClass(args);
let me know if it's seems logic to you.
thank you, Einat
Similar Messages
-
Have purchased Mumford and sons Sigh no more - 15th Nov 2013. It has appeared on other devices - nut not on the main computer. I have tried repeatedly to download again - to no avail - help. V Hetherington
We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple.
What happens when you try to redownload it ? What you can redownload will show under the Purchased link under Quicklinks on the right-hand side of the iTunes store homepage on your computer's iTunes - does that album show there ? If music shows there but not that album then is it hidden : http://support.apple.com/kb/HT4919 ? -
I have an iPhone 4 from another country but I want to connect it here in the USA what can I do
I have an iPhone 4 from another country but I want to connect it here in the USA what can I do
I wanted to do this only to find out i got screwed out of my money. There was litterally NOTHING i could do. I paid almost $300 for an expensive paperweight that i couldn't get service for anyway but in the country i bought it in.
I called Apple they said call the carrier i got the phone with. Called them they couldn't do anything. -
I have installed Adobe digital additions and have tried to authorize but keep getting error message "Connection error" . The internet connection is working and I do have an Adobe ID can you help please.
I have been using Adobe reader for PC to download my eBooks but the eBook Vendor has switch to Digital Addition,this is from sjpt,
Try completely removing any authorization using ctrl-shift-D to ADE (cmd-shift-D if on Mac).
Restart ADE, and then reauthorize with your Adobe ID. -
I have forgotten my apple id, I have created another one but my phone will still not let me access anything, anyone have an idea of how to do it?
Do what?
"will still not let me access anything" is very vague.
What exactly is it that you want? -
i am using systec usbmodule1 to send and receive CAN messages , is any one have tried this in labview?, if yes can you send me the code
thanks
Solved!
Go to Solution.Hey,
All of our CAN drivers have been written for National Instruments' CAN hardware (referenced here : http://digital.ni.com/public.nsf/allkb/E2C6ED025C798C5586256F4E00520448 ). Thus, you will have to code all your communication manually, unless Systec provides a LabVIEW driver. There might be various dll files that Systec provides for communication, which you will be able to access through LabVIEW. Take a look at the Call Library Function Node, which can be found from the Functions Palette under Connectivity -> Libraries & Executables. Here you can call a dll file, and also the individual functions within that dll.
I would suggest posting your question either to the LabVIEW forum, as previously mentioned, or to the CAN forum found here : http://forums.ni.com/ni/board?board.id=30
Justin E
National Instruments R&D -
My ipad just won't let me sign in with my apple password on FaceTime or iMessage since updating to ios7 it says check my network connection, even though my iPhone works fine with the same password, can anybody help please, I have tried numerous things but nothing works. Will I have to wait for a bug fix to sort this? I hear they are working on one a the minute, I hate ios7
Try a Restart.
Press and hold the Sleep/Wake button for a few seconds until the red "slide to power off" slider appears, and then slide the slider. Press and hold the Sleep/Wake button until the Apple logo appears.
Resetting your settings
You can also try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. You won't lose any data, but it takes time to enter all of the settings again.
Resetting your device
Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears. Apple recommends this only if you are unable to restart it.
Or if this doesn't work and nobody else on the blog doesn't have a better idea you can contact Apple.
Here is a link to their contacts with most of the information below.
http://www.apple.com/contact/ -
Im trying to build user expiration into my registration form, but I cant get the form to send back the date registering.
in my data base i have tried every thing from timestamp to datetime. I can get a timestamp but it is not functioning with the expiration?just have a look at my tutorial Login tables: installation & configuration where the required column attributes are explained and where you can obtain a fully functional SQL dump for a typical ADDT "login" and (optionally) "login_stats" table.
BTW, "expiration" will have to be an "int" column.
Cheers,
Günter -
i have just upgraded my iphone 4 to a 5. and was trying to back my 4 up on the computure so i could get all my pics and music on to my 5. but its saying i need to update my itunes which i have tried to do and is still not working any help please i have been trying for hours
how is it not working?
what version of itunes?
what ios on iphone4?
does it give an error msg? -
Please help me get my i phone screen to respond. I have suddenly found it won't respond to touch and I can't answer calls or read messages. I've tried the reset by holding the home button and off button till the logo appears to no avail. A box sometimes comes round the date and the slide to unlock sign. Any help would be great!
Try a full restore. If the screen is still unresponsive after the reset then its a harsware problem.
-
Hi
My USB CF (Compact Flash) Card reader is not mounting on my 2.5 GHZ Intel Core i5 iMac anymore.
Last week it worked fine to get pictures from my camera but now it won't mount at all.
I ejected it in the correct way rather than just disconnecting it but now i cannot get it to remount!
I cannot even see it in the disk utility or system profiler.
I have tried another card reader (a brand new one bought today) and the same problem exists. I've also tried different cards to see if that made a difference and they still arent being picked up on the Mac.
I have done all the usual things like rebooting, unplugging all other USB devices and then trying but nothing has worked.
I'm a photographer and I'm at my wits end here. I know the cards are fine as i have been using them without issue and they are also new.
Note: If I plug the camera in directly to the Mac, the Mac picks it up just fine as it always has done. Its just the card readers that it wont pick up anymore.
If anyone has any ideas at all other than the following (my so called friends advice) you'd earn my undting love:
Buy a PC
Use the camera (Thats why i bought the reader in the first place - importing RAW files from the camera is SLOW!)
Replace your CF cards (I have three 8GB cards two of which i had never used til today and they dont work either!)
Buy a new card reader (this is the 5th one in two days - none work on the Mac)
Many thanks in advance!
LIsaOK, restart in Safe Mode, this will clear some caches. It's possible one or more is corrupt. To restart in Safe Mode when you hear the start up tone hold down the Shift Key until you see a progress bar. Let it fully boot then restart normally and test.
Also I am assuming you have checked Finder - Preferences - General and see what boxes are checked in "Show these items on desktop." You can also mount an item in Disk Utility, simply highlight it and then look in the File menu for Mount..... -
my ipod touch is showing a white blank screen...have tried resetting it but nothing! any suggestions??
Let the battery drain completely. Then let it charge for about an hour before trying another reset. Helped with mine.
-
Calendar message said if I wanted to save entries for more than a month I should go to settings and change to sync for 'all events'. I did this and all but repeating birthday entries disappeared. I have tried to reverse but nothing has reappeared. HELP!
Welcome to the discussions,
WHY does it claim to be 8G but my capacity now says its just 6.83
The size of you HD is calculated binary when it comes to use it, instead of decimal when companies want to advertise there products. 1 KB=1024Byte instead of 1000KB as advertised by the manufacturer. In your case this reduces the actual available space by the factor of 0.93 or approx. 7,4GB.
If you have an "other" section in your color bar showing the different types of data on your ipod, which is bigger than 500MB, this could be a sign of corrupt data caused by a sync that did not complete or copied damaged data. A restore will reduce the size to normal again.
Restoring: http://support.apple.com/kb/HT1414
If you restore your ipod, iTunes will install the newest firmware first and then add back your data and settings from your last backup if you choose to "restore from backup". Every backup is replaced by the following one, so make sure to include this folder in your backup routine in case you'll have to go back.
You can check the location and size of the backup folder for your ipod here:
Windows Vista and Windows 7: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
copied from: About backups http://support.apple.com/kb/HT1766
Sorry, I can't answer your payment question, I have never used your kind of setup, maybe you can find something useful here: http://www.apple.com/support/itunes/ -
I have an itunes gift card which I cannot redeem. I enter the code correctly and am prompted to sign in over and over again. I have tried resetting the iPhone but the laptop I had itunes on is broken, is there another way?
See this support article:
http://support.apple.com/kb/TS1292
If you can't get to work after perusing that page, contact the iTunes Store Support; instructions are at the bottom of that article.
Good luck. -
I have reset my Apple ID & Password but I still cannot access the music I purchased using another computer, ID & PW. It keeps saying that my computer is not authorize to play the songs. I have tried everything and nothing seems to work. Help!
iPod touches or any iDevices from Apple sync only to one computer. If you sync to a different computer, all your music will be replace with the music from the new computer's iTunes. If the music were purchased from iTunes, you can re-download them again otherwise the music on iPod touch will be deleted. Do you have iTunes backup?
Maybe you are looking for
-
Hey everyone. First of all sorry if this is in the wrong discussions section. I want to buy the new iPhone and what with the rumours of it coming out in September it will coincide with my holiday. Not only will I be in the US, but I will be in San Fr
-
Hi All, We have a situation where PR to PO conversion needs to happen through a custom program which submits ME59N in batches. During this conversion, it's a business requirement to update the PO's GS Partner function based on the manufacturer in the
-
Hi all, Hope you can help me with this question: I have some layouts with 0FISCPER3, but I'm not beeing able to show text related to characteristic. So, in layouts I only get 1, 2,... instead of Jan, Feb, ... Can you help me in solving this problem:
-
Ghost Files on Thumb Drives??
So whenever I delete a file off my thumb drive while using my mac, for some reason, it shows up as having been deleted, but I don't regain memory space. When I bring my thumb drive to a PC, it shows all these files as still being on the thumb drive.
-
Loss of image quality after rotate canvas
PS7 on Win XP Windows Explorer and some software bundled with digital cameras [Canon and Panasonic] warn when rotating a picture that there may be loss of image quality. Presumably it must re-compress the jpg image file? In order to avoid that proble