Answer to Question #92569 in Java | JSP | JSF for Phillips

Question #92569
Create two classes Date and GroceryItem with their respective fields given in
1
Expert's answer
2019-08-12T12:47:32-0400
public class GroceryItem {

	private String name;
	private String department;
	private double weight;

	public GroceryItem(String name, String department, double weight) {
		this.name = name;
		this.department = department;
		this.weight = weight;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	@Override
	public String toString() {
		return "GroceryItem [name=" + name + ", department=" + department + ", weight=" + weight + "]";
	}

}
public class Date {
	private String day;
	private String month;
	private String year;

	public Date(String day, String month, String year) {
		this.day = day;
		this.month = month;
		this.year = year;
	}

	public String getDay() {
		return day;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	@Override
	public String toString() {
		return "Date [day=" + day + ", month=" + month + ", year=" + year + "]";
	}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS