Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Replace comments below with code. Replace this comment with your name and
- * assignment number.
- */
- public class Warehouse {
- /*
- * Do not change the instance variables
- */
- private int radio;
- private int tv;
- private int computer;
- public Warehouse() {
- radio = 0;
- tv = 0;
- computer = 0;
- }
- public Warehouse(int t, int c) {
- radio = 0;
- tv = t;
- computer = c;
- }
- public Warehouse(int r, int t, int c) {
- radio = r;
- tv = t;
- computer = c;
- }
- public void addRadio(int amount) {
- amount = radio;
- if (radio >= 212)
- radio = 212 + 15;
- else if (radio <= 55) {
- radio = 55 + 40;
- }
- }
- public void removeRadio(int amount) {
- /*
- * add code for this method here if amount is greater than radio display
- * the message, Insufficient radio inventory
- */
- }
- public void addTV(int amount) {
- /*
- * add code for this method here
- */
- }
- public void removeTV(int amount) {
- /*
- * add code for this method here if amount is greater than tv display
- * the message, Insufficient TV inventory
- */
- }
- public void addComputer(int amount) {
- /*
- * add code for this method here
- */
- }
- public void removeComputer(int amount) {
- /*
- * add code for this method here if amount is greater than computer
- * display the message, Insufficient computer inventory
- */
- }
- /*
- * toString() method is complete do not change code
- */
- public String toString() {
- return " The number of radios is " + radio
- + "\n The number of TV's is " + tv
- + "\n The number of computers is " + computer + "\n";
- }
- }// end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement