Advertisement
Dimitar_Ivanov_16408

kompotInfo

Feb 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1.  
  2. public class kompotInfo {
  3.     String kompotFruit;
  4.     String kompotColour;
  5.     double kompotVolume;
  6.     double kompotContent;
  7.  
  8.     void kompotInfo() {
  9.         System.out.printf("The kompot is made from: %s \n ", kompotFruit);
  10.         System.out.printf("The kompot's colour is %s \n", kompotColour);
  11.         System.out.printf("The kompot's volume is %.2f \n", kompotVolume);
  12.         System.out.printf("The kompot's content is %.2f \n", kompotContent);
  13.     }
  14. void addToContent(double ml) throws Exception {
  15.     if((this.kompotContent+ml)>this.kompotVolume) {
  16.         throw new Exception();
  17.     }
  18.     else {
  19.        
  20.     }
  21.     this.kompotContent+=ml;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement