java模拟开锁

service qq:928900200

Introduction to Computer Science II: CSCI142
Fall 2014
Lab #1
Instructor: Daniel Plante
Assigned: Monday, September 8, 2014
Turn In By: Monday, September 15, 2014 (Zipped project with all
files by MIDNIGHT)
For this lab, you will be designing and programming a number of classes representing different possible locks. You
will only be responsible for three specific lock types, but very important is the issue of how the functionality of the
locks should be abstracted into possible classes, abstract classes, and interfaces. We will design the classes by hand in
class, we will begin to use ArgoUML to create the class diagram. With this as a starting point, I will complete the
design and provide it with the rest of this assignment on Blackboard. This will be a “group” project, and as there are 14
of you in the class, you will pair up in teams of two to complete the lab. As there will be no class on Wednesday, you
will have class time to work together on this. Below is a description of the lab.
The three lock types are shown and described below:
KeyLock ComboLock KeylessEntryLock
The first lock, KeyLock, is simple, but the other two have some details that must be provided. The details are as
follows:
ComboLock
• Initially set combination of
length 3 (only set via the
constructor) with numbers
between 0 and MAX_VALUE,
either set randomly or by
providing the numbers
• 3 numbers set such that the first
and last numbers result in a
remainder x when divided by 4,
with middle number having
remainder (x+2)%4 when
divided by 4
KeylessEntryLock
• Initially set a 6-digit passcode (6DPC) in constructor
• Create new 4-digit user code (4DUC):
6DPC → * → 1 → New 4DUC → Repeat 4DUC
• Delete 4DUC:
6DPC → * → 2 → Existing 4DUC → Repeat 4DUC
• Delete ALL user codes:
6DPC → * → 6 → Reenter 6DPC
• Change 6DPC:
6DPC → * → 3 → New 6DPC → Repeat New 6DUC
• Also allows for entry with key
The design you must use and conform to will be the one we collectively decide on in class. You MUST stick to it! You
may add other properties as well as private, protected, and public methods, but the ones we agree on must also be there
and work as we agree on in class.

java模拟开锁的更多相关文章

  1. java synchronized类锁,对象锁详解(转载)

    觉得还不错 留个记录,转载自http://zhh9106.iteye.com/blog/2151791 在java编程中,经常需要用到同步,而用得最多的也许是synchronized关键字了,下面看看 ...

  2. Java使用FileLock实现Java进程互斥锁

    原理:JDK的nio包中FileLock实现类似Linux fcntl的文件锁, 可使文件被进程互斥访问.  借助此功能, 可以实现强大的Java进程互斥锁, 从而在应用层面保证同一时间只有惟一的Ja ...

  3. 多线程(五) java的线程锁

    在多线程中,每个线程的执行顺序,是无法预测不可控制的,那么在对数据进行读写的时候便存在由于读写顺序多乱而造成数据混乱错误的可能性.那么如何控制,每个线程对于数据的读写顺序呢?这里就涉及到线程锁. 什么 ...

  4. J2EE进阶(十四)超详细的Java后台开发面试题之Spring IOC与AOP

    J2EE进阶(十四)超详细的Java后台开发面试题之Spring IOC与AOP 前言   搜狐畅游笔试题中有一道问答题涉及到回答谈谈对Spring IOC与AOP的理解.特将相关内容进行整理.    ...

  5. Java并发编程(十一)-- Java中的锁详解

    上一章我们已经简要的介绍了Java中的一些锁,本章我们就详细的来说说这些锁. synchronized锁 synchronized锁是什么? synchronized是Java的一个关键字,它能够将代 ...

  6. java 中的锁 -- 偏向锁、轻量级锁、自旋锁、重量级锁(转载)

    之前做过一个测试,详情见这篇文章<多线程 +1操作的几种实现方式,及效率对比>,当时对这个测试结果很疑惑,反复执行过多次,发现结果是一样的: 1. 单线程下synchronized效率最高 ...

  7. 并发编程之 Java 三把锁

    前言 今天我们继续学习并发.在之前我们学习了 JMM 的知识,知道了在并发编程中,为了保证线程的安全性,需要保证线程的原子性,可见性,有序性.其中,synchronized 高频出现,因为他既保证了原 ...

  8. 各大公司java后端开发面试题

    各大公司Java后端开发面试题总结 ThreadLocal(线程变量副本)Synchronized实现内存共享,ThreadLocal为每个线程维护一个本地变量.采用空间换时间,它用于线程间的数据隔离 ...

  9. 【转载】Java中的锁机制 synchronized & 偏向锁 & 轻量级锁 & 重量级锁 & 各自优缺点及场景 & AtomicReference

    参考文章: http://blog.csdn.net/chen77716/article/details/6618779 目前在Java中存在两种锁机制:synchronized和Lock,Lock接 ...

随机推荐

  1. [原] XAF ListView显示隐藏Footer菜单

    using System; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Win.Editors; using DevExpress ...

  2. CentOS 一个网卡设置多个IP

    方法1:少量IP手动绑定: (这里以绑定IP到eth0为例,其它网卡的话修改相应的文件名即可) 1.复制ifcfg-eth0的网卡配置文件并改名为ifcfg-eth0:0 [root@akinlau ...

  3. Objective 笔记C(第二天)

    属性本质 •什么是属性 在OC中,属性提供了setter和getter方法,本质上属性就是方法,属性的值是由实例变量来保存的. • 属性的本质(一般三个部分组成) a.保存属性值的实例变量int _a ...

  4. jquery 编码解码

    中文转Unicode:HttpUtility.UrlEncodeUnicode(string str); 转换后中文格式:"%uxxxx" 举例:"柳_abc123&qu ...

  5. line-height,vertical-align及图片居中对齐问题根源解析

    关于图片居中对齐的问题,进入前端行业虽然有一段时间了,以为自己懂了,可是实际上还是一知半解,找了一些博客来看了一下,但是感觉讲的有点碎,看完还是一知半解. 查阅了一下<css权威指南>,结 ...

  6. 网站实时协作JavaScript库 TogetherJS

    TogetherJS是由Mozilla打造的一款可以给网站添加实时协作功能的JavaScript库,TogetherJS免费并且开源,遵循MPL 2.0开源协议,并且托管在Mozilla服务器上. 为 ...

  7. .Net下 自动执行MSI和EXE文件

    MSI是安装文件,需要系统自带的msiexec.exe来执行 var tempDir = @"D:\UploadFiles\SCADASetupWix.msi"; var star ...

  8. 微软今日发布汇总:VS2015, .NET 4.6, C# 6.0, F# 4.0等重量级产品正式上线

    Visual Studio Visual Studio 2015 下载 VS2015新功能列表 ‘ Visual Studio 2013 更新包 5.0 下载 其中包含Visual Studio 20 ...

  9. 使用media Queries实现一个响应式的菜单

    Media queries是CSS3引入的一个特性,使用它可以方便的实现各种响应式效果.在这个示例中我们将会使用media queries实现一个响应式的菜单.这个菜单会根据当前浏览器屏幕的大小变化而 ...

  10. Spring基本概念

    spring优点: 1降低组件间耦合度,实现软件各层之间的解耦. 2可以使用容器提供的各种服务.如,事务管理服务,消息服务等等. 当我们使用容器管理事务时,开发人员就不再需要手工控制事务,也不需处理复 ...