Design a system for a local food bank to keep track of food inventories. The sys
ID: 3705905 • Letter: D
Question
Design a system for a local food bank to keep track of food inventories. The system should have food items that are both perishable and non-perishable, as they accept items from community gardens. The system should have users who are either employees, volunteers or donors. The system should allow food items to be added and removed as they are given out. The system also needs to alert if perishable food is beyond it’s safe date for consumption. Inheritance: 1. User account is sub-classed into employees, volunteers and donors. 2. Food item is sub-classed into perishable and non-perishable.
I have no idea how to do this, PLEASE HELP. this code will be in JAVA
Explanation / Answer
Please run the Main.java that contains the main method
//User.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class User {
private int id;
private String name;
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getType() {
return Type;
}
private String Type;
public User(int id,String name,String Type)
{
this.name=name;
this.Type=Type;
this.id=id;
}
}
//Volunteer.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class Volunteer extends User {
public Volunteer(int id,String name, String Type) {
super(id,name, Type);
}
}
//Emp.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class Emp extends User
{
private String Designation;
public String getDesignation() {
return Designation;
}
public Emp(int id,String name, String Type,String Designation) {
super(id,name, Type);
this.Designation=Designation;
}
}
//Donars.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class Donars extends User {
public Donars(int id,String name, String Type) {
super(id,name, Type);
}
}
//Food.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class Food {
private String name;
public String getName() {
return name;
}
public String getType() {
return Type;
}
private String Type;
public Food(String name,String Type)
{
this.name=name;
this.Type=Type;
}
}
//Perishable.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class perishable extends Food {
String expDate;
public String getExpDate() {
return expDate;
}
public perishable(String name, String Type,String expDate) {
super(name, Type);
this.expDate=expDate;
}
}
//NonPerishable.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class Nonperishable extends Food {
public Nonperishable(String name, String Type)
{
super(name, Type);
}
}
//Main.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FoodBank;
/**
*
* @author Prashant Tomer
*/
public class Main {
public static void main(String[] args)
{
Emp Ram=new Emp(101,"Ram", "Employee", "Manager");
perishable pf=new perishable("Sweets","Rasgulla", "13/04/2018");
System.out.println("-----the details of Employee who handling the store------- ");
System.out.println("Employee Name:"+Ram.getName());
System.out.println("Employee Id:"+Ram.getId());
System.out.println("Employee Type:"+Ram.getType());
System.out.println("Employee Designation:"+Ram.getDesignation());
System.out.println("Food Name:"+pf.getName());
System.out.println("Food Type:"+pf.getType());
System.out.println("Food Name:"+pf.expDate);
}
}
O/P:
-----the details of Employee who handling the store-------
Employee Name:Ram
Employee Id:101
Employee Type:Employee
Employee Designation:Manager
Food Name:Sweets
Food Type:Rasgulla
Food Name:13/04/2018
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.