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. D3 学习资源

    发现这个网站还是挺不错的:http://www.ourd3js.com/wordpress/

  2. oracle ORA-00911 问题 解决

    书写sql语句 using (OracleConnection conn = new OracleConnection(OracleString)) { conn.Open(); var trans ...

  3. Lambda应用设计模式

    前言 在使用 Lambda 表达式时,我们常会碰到一些典型的应用场景,而从常用场景中抽取出来的应用方式可以描述为应用模式.这些模式可能不全是新的模式,有的参考自 JavaScript 的设计模式,但至 ...

  4. 【WPF】提高InkAnalyer手写汉字识别的准确率

    最近项目中需要用到一个手写键盘,我们使用了WPF的InkCanvas+InkAnalyer来开发. 按照文档,一般的代码写法如下: var analyzer = new InkAnalyzer(); ...

  5. asp.net 生成 excel导出保存时, 解决迅雷下载aspx页面问题

    网络上搜索,一大堆废话,以下为简单的导出生成Excel代码: string excelFile = Server.MapPath("~/SB/UpFile/20151104111008/Bo ...

  6. Arduino I2C + 三轴加速度计LIS3DH

    LIS3DH是ST公司生产的MEMS三轴加速度计芯片,实现运动传感的功能.主要特性有: 宽工作电压范围:1.71 ~ 3.6V 功耗:低功耗模式2μA:正常工作模式.ODR = 50Hz时功耗11μA ...

  7. bigautocomplete实现联想输入,自动补全

    bigautocomplete是一款Jquery插件.用它实现仿搜索引擎文本框自动补全插件功能很实用,使用也很简单,引入了插件之后写几行代码就可以实现,可以灵活设置. 先看效果图: 上图是通过ajax ...

  8. Atitit.并发编程原理与概论 attilax总结

    Atitit.并发编程原理与概论 attilax总结 1. 并发一般涉及如下几个方面:2 2. 线程安全性 ( 2.2 原子性 2.3 加锁机制2 2.1. 线程封闭3.3.1Ad-hoc线程封闭 3 ...

  9. paip.gui控件tabs控件加载内容的原理以及easyui最佳实现

    paip.gui控件tabs控件加载内容的原理以及easyui最佳实现 //////////////tabs控件的加载 同form窗体一样,俩个方式 两个方式:一个是url,简单的文本可以使用这个,不 ...

  10. IT 需要知道的一些专业名词和解释 (长期更新)

    c2c: 就是我卖东西你来买  (comsumer to comsumer个人对个人) b2c: 就是我开公司卖东西你来买 (business to comsumer 公司对个人) o2o: 就是我开 ...