99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

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

代寫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 程序設計
  • 下一篇:菲律賓工簽面簽多長時間  工簽辦理費用
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網

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

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

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          欧美激情精品久久久久| 欧美一区成人| 中日韩美女免费视频网站在线观看 | 亚洲欧美一区二区视频| 先锋影音一区二区三区| 欧美一区二区视频97| 卡通动漫国产精品| 欧美韩日亚洲| 国产精品久久久一区二区三区| 国产精品永久免费| 伊人狠狠色j香婷婷综合| 欧美日韩成人综合在线一区二区 | 国产主播精品| 亚洲成人在线网| 一本色道久久综合狠狠躁篇怎么玩| 亚洲欧美在线免费| 欧美电影免费观看高清| 欧美性色视频在线| 精品成人在线视频| 在线视频精品一区| 久久阴道视频| 国产精品毛片在线| 国产亚洲免费的视频看| av成人老司机| 久久综合成人精品亚洲另类欧美| 欧美日韩免费视频| 激情自拍一区| 亚洲欧美三级伦理| 欧美精品黄色| 永久91嫩草亚洲精品人人| 在线一区日本视频| 牛牛影视久久网| 国产欧美日韩一区二区三区在线观看| 亚洲精选中文字幕| 老司机精品久久| 国产精品视频网| 国产精品影音先锋| 久久久综合网站| 在线观看亚洲| 国产精品草草| 欧美国产日韩一区二区在线观看| 亚洲免费伊人电影在线观看av| 亚洲青色在线| 午夜精品福利在线| 欧美日韩亚洲成人| 亚洲精品少妇30p| 欧美一区1区三区3区公司| 欧美精品在线观看播放| 欧美午夜精品| 日韩一级大片| 欧美日韩精品二区| 亚洲人成艺术| 一区二区三区中文在线观看 | 蜜桃精品一区二区三区 | 欧美中文字幕| 欧美日韩亚洲国产精品| 亚洲福利视频专区| 久久久久久久激情视频| 好吊日精品视频| 午夜国产不卡在线观看视频| 国产精品久久久久免费a∨大胸| 欧美一区二区三区免费看 | 一区二区三区日韩欧美| 韩国精品久久久999| 欧美激情综合五月色丁香小说| 老司机免费视频一区二区| 午夜激情亚洲| 久久久久国产免费免费| 久久久久久久999精品视频| 亚洲综合精品自拍| 亚洲欧美色一区| 亚洲最新在线视频| 一区二区在线视频观看| 久久精品国产亚洲a| 欧美在线视频一区二区三区| 久久成人一区| 久久综合久久综合久久| 欧美另类videos死尸| 国产精品a久久久久| 国产日韩精品在线播放| 在线观看日韩www视频免费 | 可以免费看不卡的av网站| 久久久久久亚洲精品中文字幕| 亚洲欧美一级二级三级| 久热精品视频在线观看一区| 欧美国产日韩xxxxx| 国产精品日韩久久久久| 国产视频欧美| 亚洲国产成人久久综合一区| 日韩视频在线播放| 亚洲最新色图| 久久久蜜桃一区二区人| 免费在线观看一区二区| 国产精品久久久久久久第一福利 | 久久久久久久999| 亚洲一区三区电影在线观看| 加勒比av一区二区| 国产精品一国产精品k频道56| 欧美三级韩国三级日本三斤| 欧美国产视频在线| 国产日产欧美一区| 欧美成人69av| 欧美视频免费在线观看| 国产精品高潮呻吟久久av黑人| 国产精品久久国产三级国电话系列| 国产美女精品免费电影| 亚洲第一黄色| aa成人免费视频| 欧美影院在线播放| 女同一区二区| 国产精品区一区二区三| 狠狠色狠狠色综合日日五| 最新亚洲视频| 亚洲欧美在线一区二区| 久久久99国产精品免费| 久久综合伊人77777麻豆| 欧美不卡三区| 国产一区二区三区在线免费观看| 亚洲人成网在线播放| 亚洲色在线视频| 欧美一区综合| 久久久久综合网| 国产精品入口| 亚洲激情av| 欧美在线视频观看| 欧美日韩在线播放三区四区| 国产乱肥老妇国产一区二| 亚洲福利视频免费观看| 亚洲视频免费在线观看| 免费成人激情视频| 国产亚洲一区二区精品| 亚洲尤物在线视频观看| 欧美大片在线观看| 一区在线视频观看| 午夜亚洲伦理| 国产精品欧美在线| 一片黄亚洲嫩模| 欧美肥婆在线| 国产一区二区中文| 亚洲精品系列| 可以看av的网站久久看| 狠狠色狠狠色综合系列| 欧美在线观看视频在线| 国产精品国产福利国产秒拍| 99在线|亚洲一区二区| 免费在线国产精品| 一区精品在线播放| 久久久久久久一区二区| 欧美午夜大胆人体| 亚洲精品少妇30p| 欧美电影在线观看| 亚洲国产一区在线观看| 久久影视精品| 国产综合第一页| 欧美一区二区在线免费播放| 国产片一区二区| 欧美一区二区三区视频在线观看| 国产精品一卡二卡| 欧美一区免费视频| 国产主播一区二区三区| 欧美一区二区三区免费视频| 国产视频一区在线观看| 久久精品一区蜜桃臀影院| 国产综合欧美在线看| 久久在线免费| 亚洲精品小视频| 国产精品高潮久久| 欧美在线综合视频| 在线观看成人av| 欧美韩日一区二区| 艳女tv在线观看国产一区| 欧美视频在线观看免费| 亚洲一区二区三区四区五区午夜| 国产精品五月天| 久久久蜜桃一区二区人| 亚洲电影免费观看高清| 欧美人交a欧美精品| 亚洲夜间福利| 韩日欧美一区二区三区| 欧美激情免费在线| 亚洲一区区二区| 一区在线观看视频| 欧美色另类天堂2015| 欧美怡红院视频| 最近中文字幕mv在线一区二区三区四区| 欧美日韩国产不卡| 欧美一区二区三区四区在线观看| 精品69视频一区二区三区| 欧美激情视频一区二区三区免费| 香蕉成人啪国产精品视频综合网| 国产精品天美传媒入口| 免费在线成人| 午夜久久资源| 亚洲国产精品久久久久婷婷884| 欧美视频精品在线| 久久久久久久尹人综合网亚洲 | 亚洲视频精品| 1000部国产精品成人观看| 国产精品成人播放| 免费永久网站黄欧美|