Advertisement
Guest User

SecurityCamera.java

a guest
Feb 20th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. // SPENCER CODY CHIRMAN
  2. // DISCUSSION 6
  3. // FEBRUARY 20, 2020
  4. // CMIS 141 INTRODUCTORY PROGRAMMING
  5. // UNIVERSITY OF MARYLAND GLOBAL CAMPUS
  6.  
  7. // SECURITY CAMERA CLASS
  8.  
  9. public class SecurityCamera
  10. {
  11.   private boolean isRecording;
  12.   public String cameraName;
  13.  
  14.   public SecurityCamera() {
  15.     isRecording = false;
  16.     cameraName = "unnamed camera";
  17.   }
  18.  
  19.   public SecurityCamera(String name) {
  20.     isRecording = false;
  21.     cameraName = name;
  22.   }
  23.  
  24.   public void startRecording() {
  25.     if(isRecording) {
  26.       System.out.println("ERROR: " + cameraName + " already recording");
  27.       return;
  28.     }
  29.     isRecording = true;
  30.     System.out.println(cameraName + " set to record");
  31.   }
  32.  
  33.   public void stopRecording() {
  34.     if(isRecording == false) {
  35.       System.out.println("ERROR: " + cameraName + " was not recording");
  36.       return;
  37.     }
  38.     isRecording = false;
  39.     System.out.println(cameraName + " is no longer recording");
  40.   }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement