Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Choose 1 of the theme below and develop an appropriate console application using

ID: 3903153 • Letter: C

Question

Choose 1 of the theme below and develop an appropriate console application using Java. Your application should have at least 5 feature of functions. Listed below are the project themes and suggested project for each theme. You may propose your own system as well under the given theme.

I only need the source code

1) Theme1: Green Planet

a. Recyclemanagementsystem
b. Education(Quizprogramrelatedtogreenplanet)

2) Theme2: Tourism

TouristAttractionPollutionRatingSystem

TouristDestinationRatingSystem

Facilities Nearby Me System

3) Theme 3: Smart Inventory

a. KitchenPantryManagementSystem

Explanation / Answer

/*

* Theme-3 : Kitchen Pantry Management System.  

*/

import java.io.*;

import java.util.HashMap;

public class PantryManagementSystem{

int capacity;

int totalUnits;

HashMap<String, Integer> stock;

PantryManagementSystem(int capacity){

this.capacity=capacity;

this.totalUnits=0;

this.stock=new HashMap<String,Integer>();

}

//Function to check if the Kitchen Pantry is at full capacity.

boolean isFull(){

return this.totalUnits==this.capacity;

}

//Function to check if the Kitchen Pantry is empty.

boolean isEmpty(){

return this.totalUnits==0;

}

//Function to return the remaining available space in the Kitchen Pantry.

int getAvailableSpace(){

return this.capacity-this.totalUnits;

}

//Function to search for an item in the Kitchen Pantry by the name of the item.

boolean searchItem(String s){

return this.stock.containsKey(s);

}

//Function to add a new item to the Kitchen Pantry.

//Returns quantity added.

//Returns -1 if item not added.

int addItemToPantry(String s, int quantity){

try{

this.stock.put(s, this.stock.get(s) + quantity);

System.out.println("Successfully added "+quantity+" of "+s+".");

return quantity;

}

catch(Exception e){

return -1;

};

}

//Function to remove items from the Kitchen Pantry for use.

//Returns quantity used.

//Returns -1 if item not used/removed.

int useItemFromPantry(String s, int quantity){

if(!searchItem(s)){

return -1;

}

int currentQuantity=this.stock.get(s)

int finalQuantity=currentQuantity-quantity;

if(finalQuantity<0){

System.out.println("Unable to use item: Quantity required exceeds quantity available.");

return -1;

}

else{

this.stock.put(s,finalQuantity);

System.out.println("Successfully used "+quantity+" of "+s+".");

return quantity;

}

}

//Function to clear the entire contents of the Kitchen Pantry.

int clearPantry(){

this.stock=new HashMap<String,Integer>();

this.totalUnits=0;

return 0;

}

//Function to display the contents of the Kitchen Pantry.

void showPantry(){

for (Map.Entry<String, String> entry : stock.entrySet()) {

System.out.println(entry.getKey() + ": " + entry.getValue());

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote