A pmc has contacted you to help write code to control the security checkpoints for their company. You must create a checkpoint class with hidden attributes (Authorized, guest, Unauthorized), two constructors (a default that sets all access level to false and an overloaded that sets authorized and unauthorized to false and guest to true for testing purposes) and a method that changes the access levell to the next in the sequence(authorized - guest - unauthorized)
In java
Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks
// CheckPoint.java
public class CheckPoint {
private boolean authorized;
private boolean guest;
private boolean unauthorized;
// default constructor that sets all levels to false
public CheckPoint() {
authorized = false;
guest = false;
unauthorized = false;
}
// overloaded constructor that sets authorized and unauthorized to false and
// guest to true/false (depends upon the given boolean value)
public CheckPoint(boolean guest) {
authorized = false;
unauthorized = false;
// if you want to make guest true always, change the below statement to
// this.guest=true
this.guest = guest;
}
// method to advance the access level to next in the sequence (authorized -
// guest - unauthorized)
public void changeToNextLevel() {
// if the user is authorized, changing to guest
if (authorized) {
authorized = false;
guest = true;
unauthorized = false;
}
// if the user is guest, changing to unauthorized
else if (guest) {
authorized = false;
guest = false;
unauthorized = true;
}
// if the user is uauthorized or if all three values are false, changing
// to authorized
else {
authorized = true;
guest = false;
unauthorized = false;
}
}
// getter methods for access levels
public boolean isAuthorized() {
return authorized;
}
public boolean isGuest() {
return guest;
}
public boolean isUnauthorized() {
return unauthorized;
}
}
A pmc has contacted you to help write code to control the security checkpoints for their...
using java : Kenmore has contacted you to help write code to control their new line of home appliances. Write the “Refrigerator” class that has tracks the temperature of the refrigerator and the amount of water remaining in the water dispenser (max is 100 ounces). Kenmore also needs you to create a constructor and methods to increase or decrease the temperature along with dispensing water (8 ounces at a time) and refilling the water tank from a connected water hose....
[CODE] Write a class encapsulating the concept of a house, assuming a house has the following attributes: value (in dollars), a city location, and number of bedrooms. Your class name should be “House” and your code should be in a file called “House.java”. You will need to create this file. In this class, include: Private instance variables for the previously-mentioned attributes A default constructor An overloaded constructor Accessor and mutator methods (i.e., get and set methods) The toString method The...
visual basic help
DI Question 3 2 pts You may only bind an object to a control that the computer creates for you O True O False D | Question 4 2 pts The Do..Loop statement can be used to code both a pretest loop and a posttest loop. True False Question 5 2 pts You can prevent many unintentional errors from occurring in an application by declaring the variables using the maximum scope needed. True False 2 pts Question...
fisrt one is bicycle.java second code is bicycleapp.java can anyone help this??? please save my life Before you begin, DOWNLOAD the files “Lab8_Bicycle.java” and “Lab8_BicycleApp.java” from Canvas to your network drive (not the local hard drive or desktop). Once you have the files saved, RENAME THE FILES Bicycle.java and BicycleApp.java then open each file. 1) Look at the Bicycle class. Two of the many data properties we could use to define a bike are its color and the gear it...
TRUE/FALSE QUESTIONS: Foundations of Information Security and Assurance 1. There is a problem anticipating and testing for all potential types of non-standard inputs that might be exploited by an attacker to subvert a program. 2. Without suitable synchronization of accesses it is possible that values may be corrupted, or changes lost, due to over-lapping access, use, and replacement of shared values. 3. The biggest change of the nature in Windows XP SP2 was to change all anonymous remote procedure call (RPC)...
Hi. Could you help me with the code below? I need to validate the code below, using expressions that can carry out the actions or that make appropriate changes to the program’s state, using conditional and iterative control structures that repeat actions as needed. The unit measurement is missing from the final output and I need it to offer options to lbs, oz, grams, tbsp, tsp, qt, pt, and gal. & fl. oz. Can this be added? The final output...
Language is Java, any help is appreciated. Thank you! WHERE TO START FROM: import java.util.ArrayList; //PartTest.java //package simple; public class PartTest { public static void main(String[] args) { ArrayList<ExpendablePart> system=new ArrayList<ExpendablePart>(); // creating Part Object Part part1 = new ExpendablePart("Last, First"); part1.setNumber("AX-34R"); part1.setNcage("MN34R"); part1.setNiin("ABCD-RF-WDE-KLJM"); // printing information System.out.println(part1.toString()); //Create a part2 object of class Part Part part2=new ConsumablePart("Widget, purple"); part2.setNumber("12345"); part2.setNcage("OU812"); part2.setNiin("1234-12-123-1234"); // printing information System.out.println(part2.toString()); //checking equality of two Part class objects if(part1.equals(part2)) System.out.println("part1 and...
Project 7: Vehicles 1 Objective In the last couple projects, you’ve created and used objects in interesting ways. Now you’ll get a chance to use more of what objects offer, implementing inheritance and polymorphism and seeing them in action. You’ll also get a chance to create and use abstract classes (and, perhaps, methods). After this project, you will have gotten a good survey of object-oriented programming and its potential. This project won’t have a complete UI but will have a...
In Lab 5, you completed the MyRectangle class, which is a simple representation of a rectangle. Review Lab 5 before completing this lab and retrieve the MyRectangle class that you completed for this lab, since you will need it again in this lab. Before starting this lab, edit your MyRectangle class in the following way: • change the declaration of your instance variables from private to protected This will enable access of these variables by your MySquare subclass. Here is...
In java language
here is my code so far! i only need help with the extra credit
part
For this project, you will create a Rock, Paper, Scissors
game.
Write a GUI program that allows a user to play Rock, Paper,
Scissors against the computer.
If you’re not familiar with Rock, Paper, Scissors, check out the
Wikipedia page:
http://en.wikipedia.org/wiki/Rock-paper-scissors
This is how the program works:
The user clicks a button to make their move (rock, paper, or
scissors).
The program...