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接 ...
随机推荐
- Android--UI
1.layout_width 属性和 layout_height 属性:Android中所有的控件都包含这两个属性,有三种可选值 match_parent, fill_parent, wrap_con ...
- DNS主从服务,子域授权,view视图,日志系统,压力测试
DNS主从服务,子域授权,view视图,日志系统,压力测试 DNS性能测试工具queryperfDNS查询过程: DNS主从建立: 环境: 主服务器:10.140.165.93 从服务器:10.140 ...
- 20+ 个很有用的 jQuery 的 Google 地图插件
转自:http://www.oschina.net/translate/20-useful-jquery-google-maps-plugins Google 地图在寻找我们想要了解的商店或者其它有趣 ...
- 使用ODP.NET一次执行多句SQL语句
在实际开发的时候有的时候希望一次执行多句SQL语句,又不想使用Transcation的话,可以直接将多句SQL语句拼接起来.例如: var sql = "Begin " + &qu ...
- C++11 并发指南三(Lock 详解)
在 <C++11 并发指南三(std::mutex 详解)>一文中我们主要介绍了 C++11 标准中的互斥量(Mutex),并简单介绍了一下两种锁类型.本节将详细介绍一下 C++11 标准 ...
- 用jstl截取字符串
用jstl截取字符串 2011-08-01 08:55 5485人阅读 评论(0) 收藏 举报 stringfunctionjavahtmljspencoding jstl以前在jsp页面截取字符串时 ...
- TfS+强制删除签出锁定项
1.连接到tfs数据库服务器的tfsversioncontrol库: 2.查tbl_workspace表,找出相应的工作目录,比如 select * from tbl_workspace where ...
- 深入浅出OOP(五): C#访问修饰符(Public/Private/Protected/Internal/Sealed/Constants)
访问修饰符(或者叫访问控制符)是面向对象语言的特性之一,用于对类.类成员函数.类成员变量进行访问控制.同时,访问控制符也是语法保留关键字,用于封装组件. Public, Private, Protec ...
- Redis教程(八):事务详解
转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/135.html?1455806987 一.概述: 和众多其它数据库一样,R ...
- 浅谈压缩感知(三十一):压缩感知重构算法之定点连续法FPC
主要内容: FPC的算法流程 FPC的MATLAB实现 一维信号的实验与结果 基于凸优化的重构算法 基于凸优化的压缩感知重构算法. 约束的凸优化问题: 去约束的凸优化问题: 在压缩感知中,J函数和H函 ...