Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PolizzaBase implements Cloneable{
- private int value;
- private String targ;
- public PolizzaBase(String targa,int valore){
- targ=targa;
- value=valore;
- }
- public String getTarga(){
- return targ;
- }
- public int getValoreRC(){
- return value;
- }
- public int getPremioAnnuo(){
- return value/100;
- }
- public String toString(){
- return "Targa="+targ+"ValoreRC="+value;
- }
- public Object clone(){
- try{
- return super.clone();
- }
- catch(CloneNotSupportedException e){
- return null;
- }
- }
- public boolean equals(Object otherObject){
- if(otherObject==null) return false;
- if(getClass() != otherObject.getClass()) return false;
- PolizzaBase p = (PolizzaBase)otherObject;
- return targ.equals(p.targ) && value==p.value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement