Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


arvind
restrictedbar
0 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners


import java.io.*; import java.util.*; class Bar { private int weight; private int price; Bar() { } Bar(int weight,int price) { this.weight=weight; this.price=price; } public void setweight(int weight) { this.weight=weight; } public void setprice(int price) { this.price=price; } public int getweight() { return weight; } public int getprice() { return price; } public void getDetailsOfBar() {if (weight==10) { setprice(10); } else { setweight(20); setprice(14); }

}
}


Advertisement
View Answers

Related Tutorials/Questions & Answers:
 

 

 

DMCA.com