日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫CS5002、代做 java 設計程序

時間:2024-03-18  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



Assessed Exercise II
CS5002 Advanced Programming
• Deadline: 16:30 on 19th March 2024
• Contribution to final course mark: 25% • Solo or Group: Solo work
• Anticipated duration: 3 hours
Introduction
From the course Moodle page, download the files CommandRunner.java and SlowCalculator.java. The latter contains a class SlowCalculator implement- ing Runnable. Its constructor takes a number N as input and stores it. Method run performs a long, slow calculation on this number, then prints the result. You do not need to consider (or even understand) the mathematical details of what is being calculated!
In this exercise, you will write a class implementing the interface CommandRunner, that runs certain commands passed as strings. These are inputs from a user, requesting the calculation be performed for particular numbers. The inputs and outputs are read/written by a separate part of the program – you just have to use the passed string, and return a string.
As the calculation is slow, you will run it on background threads, so the user can continue to interact with the system while tasks are running. To take advantage of modern multi-core CPUs, the user may request several calculations be run in parallel. Each calculation will still run on one single thread – your goal is to let the user run multiple calculations in parallel, not to make the individual calculations faster.
Task
You will write a class called Solution that implements the CommandRunner interface. The runCommand method of this class will be passed a string, cor- responding to a command the user entered. It should perform the relevant command (see below), and return the specified output string. You should not modify the interface CommandRunner in any way. Your Solution class should have a public constructor taking no parameters.
1

The following table lists the commands the user may enter (i.e. that may be passed as the command argument to your Solution.runCommand method), and the required behaviour of your runCommand method (note N and M are long integers chosen by the user):
start N
cancel N
running
get N
after N M
finish
abort
start calculating with input N, by calling SlowCalculator.run on a new thread; imme- diately return the message “started N”
immediately cancel the calculation with input N that is currently running (do nothing if it already completed or if it was never started); when it has stopped (which should be within 0.1s) return mes- sage “cancelled N”
return a message indicating the total number of calculations currently running (i.e. exclud- ing those already completed/cancelled), and their inputs N (in any order), in the form “3 calculations running: 83**6 1000 176544”. If no calculations are running, return the string “no calculations running”.
if the calculation for N is finished, return message “result is M” where M is the integer result; if the calculation is not yet finished, return message “calculating”. If the calculation was started but already cancelled, return message “cancelled”
assuming the calculation for N is already running, schedule the calculation for M to start when that for N finishes (or is cancelled). Return the message “M will start after N” immediately (without wait- ing for either calculation). The calculation for M should not appear in running until it is actually run- ning (i.e. N has completed)
wait for all calculations previously requested by the user (including those scheduled with after) to fin- ish, and then after they are all completed, return message “finished”
immediately stop all running calculations (and dis- card any scheduled using after), and then when they are stopped (which should be within 0.1s) re- turn message “aborted”
For any command not given above (including malformed commands, e.g. N is not an integer), the method should return message “Invalid command”.
2

Note that the provided code for SlowCalculator prints the answer at the end of run(). You must remove this print statement, and replace it with a suitable mechanism to return the result so your Solution class can retrieve it. You should not modify the mathematical calculations performed by either SlowCalculator.calculateNumFactors or SlowCalculator.isPrime, but you will need to add support for interruption. You may change other parts of this class if you want (e.g. adding new fields or constructor parameters). You must not change the names of the existing methods.
Here is an example of what should happen when your program runs; the highlighted lines are commands passed to runCommand, and the remaining lines
are the messages it returns:
start 10456060
started 10456060
running
1 calculations running: 10456060
get 10456060
result is 3
start 72345680
started 72345680
start 534912560
started 534912560
get 534912560
calculating
running
2 calculations running: 72345680 534912560
cancel 72345680
Cancelled 72345680
running
1 calculations running: 534912560
finish
finished
Notes
• We will not test on pathological inputs for which the behaviour is not defined, i.e. not specified above. Please do not ask questions about any special cases you may think of (e.g. starting a calculation that is already running, or cancelling a calculation scheduled with after but not yet started). It does not matter what your program does in such cases
• Do ensure you return “Invalid command” (as mentioned above) if you receive a command that is not of the required form (e.g. N is missing or not an integer, or a command is misspelt)
• Your program should not limit the number of calculations/threads that can be run in parallel
3
           
• Your program should not print any output directly, nor read from the console
• Do not use any deprecated methods, such as Thread.stop() (such meth- ods are typically deprecated because they are dangerous, and so it is bad practice to use them)
• Remember the goal of this exercise is not to make each individual calcu- lation parallel, but to run several independent calculations for different N in parallel!
Submission
• You must implement a class Solution in file Solution.java, inheriting from CommandRunner. Do not put your code in a Java package (i.e. do not use the package keyword in any files).
• You will submit a single .zip file (not a tar, or a rar, or anything else), named 1234567.zip where 1234567 is replaced by your 7-digit numeric student ID
• This .zip file shall contain no folders, (e.g. src/), but only the .java files containing your code, including SlowCalculator.java and Solution.java, and maybe others if you wish
• Do not include CommandRunner.java in your submission
• Do not include a main method anywhere
• Upload your .zip file to Moodle before the deadline!
Mark Scheme
Your submission will be marked out of 50 points, broken down as follows: • Code is provided in the correct form and compiles successfully [5]
• start, running, get and cancel commands work as expected [20] • finish and abort commands work as expected [15]
• after command works as expected [10]
If you do not follow the exercise specification precisely, you will lose marks (your submission will be processed by a computer program; it will assume you’ve followed the instructions).
請加QQ:99515681  郵箱:99515681@qq.com   WX:codehelp 

掃一掃在手機打開當前頁
  • 上一篇:CS 3800 代做、代寫 Python ,java 程序設計
  • 下一篇:菲律賓工簽面簽多長時間  工簽辦理費用
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 trae 豆包網頁版入口 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

      <em id="rw4ev"></em>

        <tr id="rw4ev"></tr>

        <nav id="rw4ev"></nav>
        <strike id="rw4ev"><pre id="rw4ev"></pre></strike>
        国内精品亚洲| 又紧又大又爽精品一区二区| 欧美日韩国产丝袜另类| 久久精品二区| 欧美成ee人免费视频| 亚洲日本中文字幕免费在线不卡| 久久精品亚洲国产奇米99| 亚洲欧美电影在线观看| 欧美日韩国产大片| 欧美日韩高清区| 亚洲一二三区视频在线观看| 久久夜色精品国产| 国产色婷婷国产综合在线理论片a| 亚洲一级特黄| 免费成人小视频| 欧美va亚洲va国产综合| 国产精品入口尤物| 欧美日韩日日夜夜| 亚洲欧美卡通另类91av| 久久国产综合精品| 在线成人免费观看| 在线视频亚洲| 国产精品美女久久久| 亚洲电影自拍| 欧美一区二区精品在线| 香蕉久久久久久久av网站| 欧美亚洲视频在线观看| 国产精品美女一区二区在线观看| 亚洲永久在线观看| 国内精品视频在线观看| 久久综合九色欧美综合狠狠| 亚洲欧美日韩一区二区| 一区二区三区在线免费观看| 国产精品久久久亚洲一区| 欧美高清视频一区二区| 欧美精品v国产精品v日韩精品| 亚洲欧美激情一区| 亚洲精品一区久久久久久| 欧美日本三区| 亚洲精品欧美极品| 免费成年人欧美视频| 久久成年人视频| 欧美色大人视频| 欧美丝袜一区二区三区| 亚洲国产成人精品女人久久久| 亚洲精品一区二区在线| 悠悠资源网久久精品| 国产精品毛片a∨一区二区三区|国| 一区二区三区偷拍| 香蕉免费一区二区三区在线观看| 欧美色一级片| 久久精品国产精品| 在线成人av网站| 麻豆精品视频| 欧美激情精品久久久久久黑人| 看片网站欧美日韩| 国产精品日本欧美一区二区三区| 午夜精品久久久久久久白皮肤| 国产欧美日韩综合一区在线播放| 1024成人网色www| 亚洲综合大片69999| 国产美女精品一区二区三区| 翔田千里一区二区| 亚洲国产女人aaa毛片在线| 亚洲人成亚洲人成在线观看图片| 亚洲毛片播放| 精品不卡一区二区三区| 欧美淫片网站| 亚洲性感美女99在线| 欧美激情综合五月色丁香小说| 亚洲女人天堂成人av在线| 91久久综合亚洲鲁鲁五月天| 亚洲精品亚洲人成人网| 在线观看欧美亚洲| 亚洲综合精品自拍| 欧美日韩综合一区| 国产亚洲成年网址在线观看| 亚洲精品资源| 亚洲日本va午夜在线电影| 久久深夜福利免费观看| 欧美日韩免费看| 国产精品日韩欧美综合| 欧美精品亚洲一区二区在线播放| 一区二区毛片| 欧美日韩国产综合久久| 欧美理论片在线观看| 韩国精品在线观看| 欧美精品日韩综合在线| 国产精品播放| 欧美超级免费视 在线| 亚洲人体偷拍| 欧美日韩国产精品专区| 日韩午夜免费视频| 国产精品久久网| 欧美日韩国产一区精品一区| 亚洲大黄网站| 免费成人av在线| 国产精品一区二区三区成人| 国产精品一页| 亚洲国产1区| 激情综合中文娱乐网| 中文一区二区在线观看| 国产精品久久看| 久久蜜桃精品| 亚洲综合国产激情另类一区| 亚洲黄色成人久久久| 亚洲视频在线观看| 美女国产一区| 国产亚洲欧美一区二区| 亚洲小少妇裸体bbw| 欧美精品一区二区三区一线天视频| 香蕉久久国产| 老司机aⅴ在线精品导航| 亚洲一区中文字幕在线观看| 久久久久久9| 久久一区国产| 激情欧美国产欧美| 国产精品啊v在线| 六月婷婷久久| 亚洲免费影院| 国产精品久久久久aaaa樱花| 欧美中文在线视频| 亚洲深夜福利在线| 亚洲欧美日韩精品久久奇米色影视| 亚洲第一精品久久忘忧草社区| 国产精品久久久久久久久久免费看| 欧美韩日一区二区| 久久亚洲捆绑美女| 一本色道久久综合狠狠躁篇怎么玩| 夜夜嗨av一区二区三区中文字幕| 国产精品乱看| 欧美精品色一区二区三区| 久久国产乱子精品免费女| 亚洲午夜激情网站| 欧美一区91| 一区二区三区欧美在线观看| 一区二区三区四区蜜桃| 午夜久久黄色| 国产日韩精品视频一区二区三区| 老司机成人网| 尤物精品国产第一福利三区| 久久精品国产精品亚洲精品| 欧美日韩在线精品| 欧美日韩精品一区二区三区| 欧美三级电影网| 亚洲免费不卡| 欧美sm重口味系列视频在线观看| 国产自产2019最新不卡| 麻豆成人在线观看| 亚洲欧美中文日韩v在线观看| 欧美在线www| 久久av红桃一区二区小说| 国产午夜亚洲精品理论片色戒| 欧美sm极限捆绑bd| 国产精品一香蕉国产线看观看| 激情成人av| 欧美专区在线观看| 欧美午夜电影完整版| 国产欧美精品日韩精品| 国产精品久久久久久久久婷婷| 国产精品视频免费一区| 久久精品国产一区二区三区免费看| 欧美日韩另类在线| 欧美一区二区三区男人的天堂|