Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Stakan {
- private float m;
- private float v;
- private float content;
- public
- Stakan(){
- m = 30;
- v = 200;
- content = 0;
- };
- public
- Stakan(float m,float v,float c){
- this.m = m;
- this.v = v;
- content = c;
- };
- float getMass(){
- return m;
- }
- float getVolume(){
- return v;
- }
- float getContent(){
- return content;
- }
- boolean setMass(float m){
- this.m = m;
- if(m == getMass()){
- return true;
- }else{
- return false;
- }
- }
- boolean setVolume(float v){
- this.v = v;
- if(v == getVolume()){
- return true;
- }else{
- return false;
- }
- }
- boolean setContent(float C){
- content = C;
- if(C == getContent()){
- return true;
- }else{
- return false;
- }
- }
- void print(){
- System.out.println();
- System.out.print("Масса = " + getMass() + " g, ");
- System.out.print("Объем = " + getVolume() + " ml, ");
- System.out.print("Содержание = " + getContent() + " ml, ");
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement