create a simple interactive application (command line) that will allow company m
ID: 3828443 • Letter: C
Question
create a simple interactive application (command line) that will allow company management to manage the system. JAVA CODE.
user name
password
FOR THIS DATABASE;
Inventory System Component:
This system is responsible for the following:
Keeping the inventory items up to date (both in terms of purchases of items by clients and shipments of new items to be stocked and restocked)
Noting those items that need reordered
Deleting Items from the Inventory
Human Resources:
This system is responsible for the following:
Keeping track of employee information (salaries, positions, etc...)
Allow for Hiring and Firing of Employees
Displaying a Monthly Payroll report for the client
Retail Sales:
This system is responsible for the following:
Keeping Track of each sale
Finding the total price for a collection of inventory items
Explanation / Answer
CODE:-
class Employee // employee class is defined
{
// variables declared
int eid; // employee id of int data type
String name;// name of string data type
float salary; // salary of float data type
String designation; // designation of string data type
//parametrised constructor defined
public Employee(int eid,String name, float salary, String designation)
{
super();
// this keyword is defined for current class reference
this.eid=eid;
this.name = name;
this.salary = salary;
this.designation = designation;
}
public String toString()// toString method is defined
{
return "Employee [name=" + name + ", salary=" + salary + ", designation=" + designation + "]";// shows the return values
}
}
class Product// product class is defined
{
// variables dectared for the above class
int pid; // for product id
int current_stock; // for current stock
float retail_price; // for retail price of the product
float total_worth; // for total price
public Product(int pid, int current_stock, float retail_price) // parametrised constructor is //defined
{
super();
// this is keyword is defined for current class reference
this.pid = pid;
this.current_stock = current_stock;
this.retail_price = retail_price;
this.total_worth = this.current_stock*this.retail_price;
}
public int getPid()//get pID method is defined
{
return pid;// return product id
}
public float getTotal_worth() // totalworth method is defined for the total value of the //product
{
return total_worth;// return the total worth
}
public float getRetail_price()// get retailprice method is defined
{
return retail_price;// return retail price of the product
}
}
class Inventory// class Inventory is defined
{
// variables declared
int max_batches;
Product p[];//
float total_worth;
public Inventory(Product[] p) // parametrized constructor is defined
{
super();
// this is keyword is defined for current class reference
this.p = p;
this.total_worth=0;
for(int i=0;i<p.length;i++)// for loop is defined for printing thr result
{
this.total_worth+=p[i].total_worth;
}
}
void restock(Product P,int batches)// method defined
{
System.out.println("order "+P.getPid()+"in batches of "+batches);// print statement to //print the order and batches
}// end of method
}// end of inventory class
class Client// client class is defined
{
//variables are dectered
int cid;//for client id
String name;// for client name
String address;// for client address
String contant;// for contact
float total_purchase;// for total_purchase of the product
public Client(int cid, String name, String address, String contant)// constructor is defined
{
super();
// this is keyword is defined for current class reference
this.cid = cid;
this.name = name;
this.address = address;
this.contant = contant;
}
}
class Order // order class is defined
{
// variables are defined
Client c;
Product p;
int quantity; // for quality
String date; // for date
float amount; // amount
public Order(Client c, Product p, int quantity, String date)
//constructor is defined
{
super();
// this is keyword is defined for current class reference
this.c = c;
this.quantity=quantity;
this.date = date;
this.amount = p.getRetail_price()*quantity;
}
public String toString()//toString method is defined
{
return "Order [c=" + c + ", p=" + p.pid + ", quantity=" + quantity + ", date=" + date + ", amount=" + amount + "]"; // return the values
}
}
( Define the main method and create the object of the given class and call the methods for the respective classes.)
NOTE:- All the required classes are defined above only. the output is not given just because main method is not defined in the above code.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.