Question

write comments // on this program please //Inside package bloodDonation //BloodDonor.java class package bloodDonation; import java.text.ParseException;...

write comments // on this program please

//Inside package bloodDonation
//BloodDonor.java class
package bloodDonation;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class BloodDonor {
    long idNumber, cardNumber;
    String name, bloodGroup, homePhone, mobilePhone, address, lastDateOfDonation;
    SimpleDateFormat myFormat = new SimpleDateFormat("dd MM yyyy");
    public BloodDonor(){
        this.idNumber = 0;
        this.cardNumber = 0;
        this.name = "";
        this.bloodGroup = "";
        this.homePhone = "";
        this.mobilePhone = "";
        this.address = "";
        this.lastDateOfDonation = "";
    }
    public BloodDonor(long idNumber, long cardNumber, String name, String bloodGroup, String homePhone, String mobilePhone,
               String address, String lastDateOfDonation) {
        this.idNumber = idNumber;
        this.cardNumber = cardNumber;
        this.name = name;
        this.bloodGroup = bloodGroup;
        this.homePhone = homePhone;
        this.mobilePhone = mobilePhone;
        this.address = address;
        this.lastDateOfDonation = lastDateOfDonation;
    }
    //Setter
    public void setName(String name) {
        this.name = name;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public void setBloodGroup(String bloodGroup) {
        this.bloodGroup = bloodGroup;
    }
    public void setCardNumber(long cardNumber) {
        this.cardNumber = cardNumber;
    }
    public void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }
    public void setIdNumber(long idNumber) {
        this.idNumber = idNumber;
    }
    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }
    public void setLastDateOfDonation(String lastDateOfDonation) {
        this.lastDateOfDonation = lastDateOfDonation;
    }
    //Getter
    public String getName() {
        return name;
    }
    public String getAddress() {
        return address;
    }
    public long getCardNumber() {
        return cardNumber;
    }
    public long getIdNumber() {
        return idNumber;
    }
   

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Following is the answer:

import java.text.SimpleDateFormat; public class BloodDonor { //variables long idNumber, cardNumber; String name, bloodGroup, homePhone, mobilePhone, address, lastDateOfDonation; //SimpleDateFormat class is used to parse and format dates in a given format SimpleDateFormat myFormat = new SimpleDateFormat("dd MM yyyy"); //Default constructor that set the default value to all variables public BloodDonor() { this.idNumber = 0; this.cardNumber = 0; this.name = ""; this.bloodGroup = ""; this.homePhone = ""; this.mobilePhone = ""; this.address = ""; this.lastDateOfDonation = ""; } //Constructor with parameter that pass parameters to set the values public BloodDonor(long idNumber, long cardNumber, String name, String bloodGroup, String homePhone, String mobilePhone, String address, String lastDateOfDonation) { this.idNumber = idNumber; this.cardNumber = cardNumber; this.name = name; this.bloodGroup = bloodGroup; this.homePhone = homePhone; this.mobilePhone = mobilePhone; this.address = address; this.lastDateOfDonation = lastDateOfDonation; } //Setter method setName to set the name public void setName(String name) { this.name = name; } //Setter method setAddress to set the address public void setAddress(String address) { this.address = address; } //Setter method setBloodGroup to set the bloodgroup public void setBloodGroup(String bloodGroup) { this.bloodGroup = bloodGroup; } //Setter method setCardNumber to set the cardNumber public void setCardNumber(long cardNumber) { this.cardNumber = cardNumber; } //Setter method setHomePhone to set the homePhone public void setHomePhone(String homePhone) { this.homePhone = homePhone; } //Setter method setIdNumber to set the Id public void setIdNumber(long idNumber) { this.idNumber = idNumber; } //Setter method setMobilePhone to set the MobilePhone public void setMobilePhone(String mobilePhone) { this.mobilePhone = mobilePhone; } //Setter method setLastDateOfDonation to set the lastDonationdate public void setLastDateOfDonation(String lastDateOfDonation) { this.lastDateOfDonation = lastDateOfDonation; } //Getter method to get name public String getName() { return name; } //Getter method to get address public String getAddress() { return address; } //Getter method to get card number public long getCardNumber() { return cardNumber; } //Getter method to get Id public long getIdNumber() { return idNumber; } } 
Add a comment
Know the answer?
Add Answer to:
write comments // on this program please //Inside package bloodDonation //BloodDonor.java class package bloodDonation; import java.text.ParseException;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I have a java class that i need to rewrite in python. this is what i...

    I have a java class that i need to rewrite in python. this is what i have so far: class Publisher: __publisherName='' __publisherAddress=''    def __init__(self,publisherName,publisherAddress): self.__publisherName=publisherName self.__publisherAddress=publisherAddress    def getName(self): return self.__publisherName    def setName(self,publisherName): self.__publisherName=publisherName    def getAddress(self): return self.__publisherAddress    def setAddress(self,publisherAddress): self.__publisherAddress=publisherAddress    def toString(self): and here is the Java class that i need in python: public class Publisher { //Todo: Publisher has a name and an address. private String name; private String address; public Publisher(String...

  • CS HELP Use sets to solve this problem package log; import java.io.IOException; import java.io.Reader; import java.util.ArrayList;...

    CS HELP Use sets to solve this problem package log; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class LogParser { /** * Returns a list of SuspectEntries corresponding to the CSV data supplied by the given Reader. * * The data contains one or more lines of the format: * * Marc,413-545-3061,1234567890 * * representing a name, phone number, and passport number. * * @param r an open Reader object * @return a list of SuspectEntries...

  • How to create a constructor that uses parameters from different classes? I have to create a...

    How to create a constructor that uses parameters from different classes? I have to create a constructor for the PrefferedCustomer class that takes parameters(name, address,phone number, customer id, mailing list status, purchase amount) but these parameters are in superclasses Person and Customer. I have to create an object like the example below....... PreferredCustomer preferredcustomer1 = new PreferredCustomer("John Adams", "Los Angeles, CA", "3235331234", 933, true, 400); System.out.println(preferredcustomer1.toString() + "\n"); public class Person { private String name; private String address; private long...

  • Write a program in Java that prompts a user for Name and id number. and then...

    Write a program in Java that prompts a user for Name and id number. and then the program outputs students GPA MAIN import java.util.StringTokenizer; import javax.swing.JOptionPane; public class Main {    public static void main(String[] args) {                       String thedata = JOptionPane.showInputDialog(null, "Please type in Student Name. ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE);        String name = thedata;        Student pupil = new Student(name);                   //add code here       ...

  • write a parent class that describes a parcel (like a package, as shown below) and a...

    write a parent class that describes a parcel (like a package, as shown below) and a child class that describes an overnight parcel. Use the provided Address class. A parcel is described by: id (which might contain numbers and letters) weight (described as the number of pounds; a parcel could be less than 1 pound) destination address (uses the provided class) An overnight parcel is described by id, weight, destination address and also: whether or not a signature is required...

  • I need help converting the following two classes into one sql table package Practice.model; impor...

    I need help converting the following two classes into one sql table package Practice.model; import java.util.ArrayList; import java.util.List; import Practice.model.Comment; public class Students {          private Integer id;    private String name;    private String specialties;    private String presentation;    List<Comment> comment;       public Students() {}       public Students(Integer id,String name, String specialties, String presentation)    {        this.id= id;        this.name = name;        this.specialties = specialties;        this.presentation = presentation;        this.comment = new ArrayList<Commment>();                  }       public Students(Integer id,String name, String specialties, String presentation, List<Comment> comment)    {        this.id= id;        this.name...

  • JAVA How to add array to develop a contact list application for the person class objects...

    JAVA How to add array to develop a contact list application for the person class objects developed in this code? The application will include functionality to add, remove, sort and search the contact list. You should also include a method to output the contents of a contact searched for, and also to output the entire list. The code: package BankProg; public class personal {    private String facebook;    public personal() { }    public personal(String facebook) {    this.facebook...

  • Given attached you will find a file from Programming Challenge 5 of chapter 6 with required...

    Given attached you will find a file from Programming Challenge 5 of chapter 6 with required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions: An empty string is given for the employee’s name. An invalid value is given to the employee’s ID number. If you implemented this field as a string, then an empty string could be invalid. If you implemented this field as a numeric variable, then a...

  • Need help with the program DemoSugarSmash.java import java.util.*; public class DemoSugarSmash { public static void main(String[]...

    Need help with the program DemoSugarSmash.java import java.util.*; public class DemoSugarSmash { public static void main(String[] args) { // Complete the demo program here } } PremiumSugarSmashPlayer.java public class PremiumSugarSmashPlayer { // Define the PremiumSugarSmashPlayer class here } PremiumSugarSmashPlayer.java public class SugarSmashPlayer { private int playerID; private String screenName; private int[] scoresArray ; public SugarSmashPlayer() { this.scoresArray = new int[10]; } public SugarSmashPlayer(int levels) { this.scoresArray = new int[levels]; } public int getIdNumber() { return playerID; } public void setIdNumber(int...

  • I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student...

    I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student {    private String name;    private double gpa;    private int idNumber;    public Student() {        this.name = "";        this.gpa = 0;        this.idNumber = 0;    }    public Student(String name, double gpa, int idNumber) {        this.name = name;        this.gpa = gpa;        this.idNumber = idNumber;    }    public Student(Student s)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT