mercredi 28 octobre 2020

how to apply if else statement [closed]

Our prof give us an activity to create a overloaded constructor that stores blood type. My problem is I don't how to apply the if else statements to this 2 objects. If the user did not input values Hence, the values stored in the default constructor are displayed. This is only the part of the code where I only have problem with.

    BloodData bd = new BloodData(input1,input2);
    bd.display();
    System.out.println(" is added to the blood bank.");   

    // if the user did not input values, the values stored in the default constructor should display.
    BloodData bd = new BloodData();
    bd.display();
    System.out.println(" is added to the blood bank.");

Aucun commentaire:

Enregistrer un commentaire