Posts

Showing posts with the label Pojo Class

In Java, Project Donation For Cheery Charities

Image
import java.util.Scanner; class Project{ private double targetDonation; private double actualDonation; private String name; private String sponsor; private int nosOfDonations; public Project(){ this(1000, "", ""); } public Project(double targetDonation, String name){ this(targetDonation, name, ""); } public Project(double targetDonation, String name, String sponsor){ setTargetDonation(targetDonation); setSponsor(sponsor); setName(name); setNosOfDonations(0); } public boolean setTargetDonation(double targetDonation){ if(0 < targetDonation){ this.targetDonation = targetDonation; return true; } return false; } public boolean addDonation(double donation){ boolean added = setActualDonation(getActualDonation() + (donation*2)); if(added) nosOfDonations ++; return added; } ...

In Java, Implement List Of Inventory

Image
import java.util.List; import java.util.LinkedList; public class InventoryListImpl implements InventoryList{ private List<Inventory> list; public InventoryListImpl(){ list = new LinkedList<Inventory>(); } public int getSize(){ return list.size(); } public boolean add(Inventory item){ int size = getSize(), cmp; if(MAX_SIZE == size) return false; for(int i = 0; size > i; i ++){ cmp = list.get(i).getName().compareTo(item.getName()); if(0 == cmp){ return false; } else if(0 < cmp){ list.add(i, item); i = size; return true; } } list.add(item); return true; } public Inventory remove(Inventory item){ int size = getSize(); if(0 == size) return null; for(int i = 0; size > i; i ++){ if(0 == list.get(i).getName().compareTo(item.getName())){ return list.remove(i); } } return null; } public boolean contains(Inventory item){ int size = getSize(); if(0 == size) return false; for(int i = 0;...

⚡ Java Program🔥ATM Simulation #tecqmate

Image
import java.util.Date; public class Account { private int id=0; private double balance=0; private double annualIntrestRate=0; private Date dateCreated; public Account() { super(); } public Account(int id, double balance) { super(); this.id = id; this.balance = balance; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public double getAnnualIntrestRate() { return annualIntrestRate; } public void setAnnualIntrestRate(double annualIntrestRate) { this.annualIntrestRate = annualIntrestRate; } public Date getDateCreated() { return dateCreated; } public void setDateCreated(Date dateCreated) { this.dateCreated = dateCreated; } public double getMo...

Car for Hire | Java Swing Car Hire Desktop Application

Image
Download code here .

Person and Customer class in Java

Image
Download code here .