91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区

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

代寫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號線
  • 短信驗證碼 目錄網 排行網

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

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

    91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区
    国产精品国产成人国产三级 | 一区二区三区久久久| 欧美日韩你懂得| 一本一道综合狠狠老| 午夜亚洲性色福利视频| 国产日产精品一区二区三区四区的观看方式 | 国产一区二区三区久久悠悠色av| 一区二区久久久久久| 亚洲免费毛片网站| 亚洲综合激情网| 亚洲一本大道在线| 天堂在线一区二区| 全部av―极品视觉盛宴亚洲| 久久精品国产亚洲高清剧情介绍| 免费的成人av| 国产福利一区在线观看| 国产91精品露脸国语对白| 国产成人鲁色资源国产91色综| 国产精品一区二区三区99| www.亚洲激情.com| 在线欧美福利| 久久久精品动漫| 欧美日韩一区 二区 三区 久久精品| 欧美精品xxxxbbbb| 2023国产精品| 亚洲精品伦理在线| 日本成人超碰在线观看| 国产91对白在线观看九色| 91网站在线播放| 在线一区亚洲| 91精品午夜视频| 中文字幕第一区二区| 亚洲妇熟xx妇色黄| 国产一区二区精品久久| 欧美日韩亚洲一区| 久久精品动漫| 精品1区2区在线观看| 一区二区三区日韩| 韩国成人福利片在线播放| 欧美激情成人在线| 色噜噜夜夜夜综合网| 337p日本欧洲亚洲大胆色噜噜| 亚洲女女做受ⅹxx高潮| 久久激情五月激情| 欧美日韩高清在线一区| 91久久精品午夜一区二区| 亚洲精品一线二线三线| 天天操天天色综合| 97久久超碰国产精品| 久久久久久久久一区二区| 久久亚洲欧美国产精品乐播| 午夜精品福利久久久| 色综合久久中文综合久久97| 久久三级视频| 中文字幕高清不卡| 国产综合一区二区| 夜夜爽99久久国产综合精品女不卡| 3d成人动漫网站| 亚洲男人都懂的| 高清免费成人av| 色婷婷综合久久久中文字幕| 久久久精品2019中文字幕之3| 日韩高清在线观看| 国产一区二区三区自拍| 日韩一区二区三区av| 亚洲成人激情社区| 欧美午夜欧美| 精品国精品自拍自在线| 免费人成黄页网站在线一区二区| 国产在线一区二区三区四区| 91麻豆精品国产| 亚洲成a人片综合在线| 欧美日韩国语| 日韩欧美一区在线观看| 婷婷一区二区三区| 国产精品v欧美精品v日本精品动漫| 欧美日本在线播放| 婷婷综合在线观看| 亚洲精选国产| 中文天堂在线一区| 99久久精品免费看| 欧美精品日韩一区| 青青草成人在线观看| 国产欧美日韩伦理| 国产精品久久久久永久免费观看 | 久久综合丝袜日本网| 国产伦精品一区二区三区在线观看 | 国产农村妇女精品一二区| 国产精品视频一二三| 97精品国产露脸对白| 欧美成人高清电影在线| 国产一区在线看| 欧美亚洲国产bt| 麻豆91在线看| 欧美丝袜第三区| 久久精品国产第一区二区三区| 男女精品视频| 亚洲成a人片综合在线| 国产嫩草一区二区三区在线观看| 一区二区三区丝袜| 欧美专区18| 日韩在线a电影| 精品视频一区二区三区免费| 另类调教123区| 欧美精品第一页| 国产成人精品一区二区三区四区 | 久久精品99国产精品| 欧美理论片在线| 国产精品亚洲综合一区在线观看| 欧美色综合影院| 韩国精品主播一区二区在线观看| 欧美精品1区2区| 国产一区二区精品久久99| 欧美一区二区久久| 成人黄色国产精品网站大全在线免费观看 | 日韩三级免费观看| 成人动漫视频在线| 国产欧美一区二区在线观看| 欧美三区视频| 一区二区理论电影在线观看| 久久九九电影| 久久国产生活片100| 日韩一区二区三区视频在线| 91理论电影在线观看| 国产精品青草久久| 亚洲欧美日韩另类精品一区二区三区 | 加勒比av一区二区| 精品国产乱码久久久久久久久| 99精品国产一区二区三区不卡| 日本一区二区三区高清不卡| 国产一区二区三区久久| 男人的天堂亚洲一区| 欧美一区二区三区不卡| 欧美激情aⅴ一区二区三区| 亚洲国产wwwccc36天堂| 欧美日本一道本| 欧美精品亚洲精品| 日日夜夜一区二区| 日韩欧美在线综合网| 亚洲成人在线| 久久精工是国产品牌吗| 国产日韩欧美麻豆| 久久精品女人天堂| 一区二区三区在线看| 亚洲午夜久久久久久久久久久| 久久黄色网页| 国产成人在线看| 亚洲三级免费电影| 欧美卡1卡2卡| 亚洲久久一区二区| 国产福利电影一区二区三区| 自拍偷拍国产亚洲| 欧美一区二区三区思思人| 欧美日韩亚洲一区二区三区在线| 日韩av电影免费观看高清完整版在线观看| 日韩欧美国产午夜精品| 亚洲精品日韩在线观看| 国产成人av影院| 亚洲午夜久久久久久久久电影院 | 欧美一区二区三区免费观看视频 | 国产精品网站导航| 欧美熟乱第一页| 国产亚洲在线观看| 中文字幕欧美激情一区| 亚洲成人综合视频| 日韩三级在线免费观看| 亚洲一区二区三区免费在线观看| 国产河南妇女毛片精品久久久| 一区二区欧美在线观看| 久久久美女艺术照精彩视频福利播放| 久久综合影音| 欧美日韩三区四区| 成人性生交大片免费看在线播放 | 美女视频黄久久| 亚洲色图.com| 久久人人97超碰com| 欧美日韩一级视频| 国产精品久久久一区二区| 欧美久久99| 国产不卡在线视频| 久久国内精品视频| 日韩av电影天堂| 亚洲已满18点击进入久久| 欧美激情一区二区三区四区| 欧美猛男gaygay网站| 久久人人超碰| 久久成人麻豆午夜电影| 国产精品家庭影院| 久久久三级国产网站| 日韩免费视频一区二区| 欧美丝袜丝交足nylons图片| 久久精品盗摄| 乱码第一页成人| 久久本道综合色狠狠五月| 日韩午夜在线电影| 亚洲精品日韩久久| 亚洲最新在线| 一区二区三区四区五区精品| 亚洲第一在线| 亚洲视频二区|