java模拟开锁
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模拟开锁的更多相关文章
- java synchronized类锁,对象锁详解(转载)
觉得还不错 留个记录,转载自http://zhh9106.iteye.com/blog/2151791 在java编程中,经常需要用到同步,而用得最多的也许是synchronized关键字了,下面看看 ...
- Java使用FileLock实现Java进程互斥锁
原理:JDK的nio包中FileLock实现类似Linux fcntl的文件锁, 可使文件被进程互斥访问. 借助此功能, 可以实现强大的Java进程互斥锁, 从而在应用层面保证同一时间只有惟一的Ja ...
- 多线程(五) java的线程锁
在多线程中,每个线程的执行顺序,是无法预测不可控制的,那么在对数据进行读写的时候便存在由于读写顺序多乱而造成数据混乱错误的可能性.那么如何控制,每个线程对于数据的读写顺序呢?这里就涉及到线程锁. 什么 ...
- J2EE进阶(十四)超详细的Java后台开发面试题之Spring IOC与AOP
J2EE进阶(十四)超详细的Java后台开发面试题之Spring IOC与AOP 前言 搜狐畅游笔试题中有一道问答题涉及到回答谈谈对Spring IOC与AOP的理解.特将相关内容进行整理. ...
- Java并发编程(十一)-- Java中的锁详解
上一章我们已经简要的介绍了Java中的一些锁,本章我们就详细的来说说这些锁. synchronized锁 synchronized锁是什么? synchronized是Java的一个关键字,它能够将代 ...
- java 中的锁 -- 偏向锁、轻量级锁、自旋锁、重量级锁(转载)
之前做过一个测试,详情见这篇文章<多线程 +1操作的几种实现方式,及效率对比>,当时对这个测试结果很疑惑,反复执行过多次,发现结果是一样的: 1. 单线程下synchronized效率最高 ...
- 并发编程之 Java 三把锁
前言 今天我们继续学习并发.在之前我们学习了 JMM 的知识,知道了在并发编程中,为了保证线程的安全性,需要保证线程的原子性,可见性,有序性.其中,synchronized 高频出现,因为他既保证了原 ...
- 各大公司java后端开发面试题
各大公司Java后端开发面试题总结 ThreadLocal(线程变量副本)Synchronized实现内存共享,ThreadLocal为每个线程维护一个本地变量.采用空间换时间,它用于线程间的数据隔离 ...
- 【转载】Java中的锁机制 synchronized & 偏向锁 & 轻量级锁 & 重量级锁 & 各自优缺点及场景 & AtomicReference
参考文章: http://blog.csdn.net/chen77716/article/details/6618779 目前在Java中存在两种锁机制:synchronized和Lock,Lock接 ...
随机推荐
- C++ map使用(基于RBTree)
一.insert ◦1)用insert函数插入pair数据 ◦map<int, string> mapStudent; ◦mapStudent.insert(pair<int, st ...
- oracle dblink调用函数
select 用户名.函数名@DBLINK名称(参数) from dual; e.g. select newbosid@TEST('1234ECMA') from dual; -- 成功执行 sel ...
- Hibernate映射之OneToOne(第二篇)
这是在项目中实际遇到的一个问题,纠结了很久.一开始参考mkyong的 ,两边都写OneToOne ,后来查看了一下项目经理在原来一些模块中的写法. 学习一下: 首先是E-R图: 一个货品可以进行多次 ...
- 盘点国内网站常用的一些 CDN 公共库加速服务
CDN公共库是指将常用的JS库存放在CDN节点,以方便广大开发者直接调用.与将JS库存放在服务器单机上相比,CDN公共库更加稳定.高速.一 般的CDN公共库都会包含全球所有最流行的开源JavaScri ...
- 用c#开发微信 (10) JS-SDK 基本用法- 分享接口“发送到朋友”
微信JS-SDK是微信公众平台面向网页开发者提供的基于微信内的网页开发工具包.通过使用微信JS-SDK,网页开发者可借助微信高效地使用拍照.选图.语音.位置等手机系统的能力,同时可以直接使用微信分享. ...
- 大熊君说说JS与设计模式之------策略模式Strategy
一,总体概要 1,笔者浅谈 策略模式,又叫算法簇模式,就是定义了不同的算法,并且之间可以互相替换,此模式让算法的变化独立于使用算法的客户. 策略模式和工厂模式有一定的类似,策略模式相对简单容易理解,并 ...
- 转评:你造promise就是monad吗
看到一遍好文章,与我的想法如出一辙,先转为敬.首先说说我对Monad和promise的理解: Monad的这种抽象方式是为了简化程序中不确定状态的判断而提出的,能够让程序员从更高的层次顺序描述程序逻辑 ...
- SQLServer DBA 三十问(加强版)
距离最初发布SQLServer DBA 三十问 已有一年多了,大家对其中的某些问题讨论比较激烈,要回答出来这些问题需要比较扎实的SQLServer 基础和一定的实际操作经验,如果你试着去回答其中的问题 ...
- RSA密钥的跨平台通用
RSA使用public key加密,用private key解密(签名相反,使用private key签名,用public key验证签名).比如我跟合作方D之间的数据传输,我使用D提供给我的publ ...
- Linux 进程
Linux 进程 在用户空间,进程是由进程标识符(PID)表示的.从用户的角度来看,一个 PID 是一个数字值,可惟一标识一个进程.一个 PID 在进程的整个生命期间不会更改,但 PID 可以在进程销 ...