Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 19th, 2013  |  syntax: None  |  size: 1.94 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**
  2.  * Replace comments below with code. Replace this comment with your name and
  3.  * assignment number.
  4.  */
  5. public class Warehouse {
  6.     /*
  7.      * Do not change the instance variables
  8.      */
  9.  
  10.     private int radio;
  11.     private int tv;
  12.     private int computer;
  13.  
  14.     public Warehouse() {
  15.         radio = 0;
  16.         tv = 0;
  17.         computer = 0;
  18.     }
  19.  
  20.     public Warehouse(int t, int c) {
  21.         radio = 0;
  22.         tv = t;
  23.         computer = c;
  24.     }
  25.  
  26.     public Warehouse(int r, int t, int c) {
  27.         radio = r;
  28.         tv = t;
  29.         computer = c;
  30.     }
  31.  
  32.     public void addRadio(int amount) {
  33.         amount = radio;
  34.         if (radio >= 212)
  35.            radio = 212 + 15;
  36.         else if (radio <= 55) {
  37.             radio = 55 + 40;
  38.         }
  39.        
  40.     }
  41.  
  42.     public void removeRadio(int amount) {
  43.         /*
  44.          * add code for this method here if amount is greater than radio display
  45.          * the message, Insufficient radio inventory
  46.          */
  47.     }
  48.  
  49.     public void addTV(int amount) {
  50.         /*
  51.          * add code for this method here
  52.          */
  53.     }
  54.  
  55.     public void removeTV(int amount) {
  56.         /*
  57.          * add code for this method here if amount is greater than tv display
  58.          * the message, Insufficient TV inventory
  59.          */
  60.     }
  61.  
  62.     public void addComputer(int amount) {
  63.         /*
  64.          * add code for this method here
  65.          */
  66.     }
  67.  
  68.     public void removeComputer(int amount) {
  69.         /*
  70.          * add code for this method here if amount is greater than computer
  71.          * display the message, Insufficient computer inventory
  72.          */
  73.     }
  74.  
  75.     /*
  76.      * toString() method is complete do not change code
  77.      */
  78.     public String toString() {
  79.         return "  The number of radios is " + radio
  80.                 + "\n  The number of TV's is " + tv
  81.                 + "\n  The number of computers is " + computer + "\n";
  82.  
  83.     }
  84. }// end class
clone this paste RAW Paste Data