代做CSSE1001作业、Python编程设计作业代写、代做we
CSSE1001 / 7030 Semester 1, 2019Assignment 2 (15 Marks)Due: Friday 3 May 2019 at 8:30pmIntroductionThe second assignment is a simple weather prediction and event planning system. You will providesome information about how the weather could affect an event. The system will predict the weatherand indicate if conducting the event is advisable.The purpose of this assignment is to help you to understand how to make use of classes to definean object’s structure. And, to help you understand how to implement program functionality byhaving several objects interacting with each other, by sending messages to each other.OverviewYou are provided with three files for this assignment. They are weather_data.py,prediction.py and event_decision.py. Each file defines a set of classes, which are describedbelow. You will need to implement parts, or all, of the classes in the prediction.py andevent_decision.py files.The file, weather_data.py, contains the WeatherData and WeatherDataItem classes.WeatherData represents all the weather data that is loaded from the data file. WeatherDataItemrepresents weather data for a single day. It provides methods to access this data.The prediction.py file defines the super class WeatherPrediction. It defines a set of methodsthat you need to override in subclasses that you implement for the assignment. An example of doingthis is provided by the YesterdaysWeather subclass. You need to implement the SimplePredictionand SophisticatedPredication subclasses.The file, event_decision.py, provides a description of the EventDecision class. It uses dataabout the event to determine if aspects of the weather would impact on the event. You will needto implement the __init__ and advisability methods. The advisability method determines howadvisable it is to continue with the event, based on the weather prediction. Two other classesdefined in this file are Event and UserInteraction. The Event class represents the data about anevent and defines a set of methods that you will need to implement. The UserInteraction classprovides methods that allow the program to interact with the user. It defines a set of methods thatyou will need to implement. Two of these methods, get_prediction_model and output_advisability,are partially implemented with some example ideas that you may use in your solution.CSSE1001 / 7030 Semester 1, 2019DesignThe following diagram provides an overview of the classes in this design and their relationships.The WeatherDataItem class defines a type of object that holds weather data for one day. It storesthe amount of rainfall, the maximum and minimum temperatures, the number of hours of sunshine,average relative humidity, average and maximum wind speeds, predominant direction of the wind,extent of cloud cover and the mean sea level air pressure. This is the data that will be used to predictthe next day’s weather. The WeatherDataItem class has methods that provide access to the data.An object of the WeatherData class loads the weather data from a file and creates a list ofWeatherDataItem objects to hold the data. The load method takes a string as a parameter that isthe name of the file from which the file is to be loaded. The get_data method takes an integerparameter that is the number of days of data to return. The data is returned as a list ofWeatherDataItem objects. The size method returns the number of WeatherDataItems being storedin the WeatherData object.The WeatherData and WeatherDataItem classes are implemented for you.The WeatherPrediction class defines the abstract interface for any weather prediction model. Eachdifferent prediction model will be a subclass of WeatherPrediction. The WeatherPrediction classhas a reference to a WeatherData object, which is used to access the data to make a prediction.Each of the methods in WeatherPrediction, aside from __init__, raise the NotImplementedError.This is because these methods need to be implemented in the subclasses. An example of doing thisis provided by the YesterdaysWeather class. An object of this class makes a prediction by accessingyesterday’s WeatherDataItem object and using its data to indicate that tomorrow’s weather will bepretty much the same as yesterday’s. You need to implement subclasses for two other predictionmodels. These are called SimplePrediction and SophisticatedPrediction.CSSE1001 / 7030 Semester 1, 2019An object of the EventDecision class uses the predictions made by one of the subclasses ofWeatherPrediction and the details from an object of the Event class to indicate how advisable it isto continue with an event.An object of the UserInteraction class provides the user interface that allows a user to interact withthe program. It gets the details of an event from the user and creates an Event object to hold thisdata. It also allows a user to select which weather prediction model to use and creates theappropriate object of a subclass of WeatherPrediction. When it does this it passes the WeatherDataobject to the WeatherPrediction object. After the EventDecision object has determined theadvisability of continuing with the event, the UserInteraction object is given the advisability ratingand outputs these details to the user. The UserInteraction object also provides a method to checkto see if the user wants to try checking the advisability using a different prediction model.The main function starts the execution of the program. It creates a WeatherData object and gets itto load the data from a file. It creates a UserInteraction object to provide the user interface. Themain function gets the user interface to ask the user for event details and to choose the predictionmodel. Once this is done, the main function then gets the EventDecision object to determine theadvisability of continuing with the event and then has the user interface output the result.Example UsageLets determine how suitable your event is for the predicted weather.What is the name of the event? My EventIs the event outdoors? YIs there covered shelter? YWhat time is the event? 18Select the weather prediction model you wish to use: 1) Yesterdays weather. 2) Simple prediction. 3) Sophisticated prediction.> 1Based on the YesterdaysWeather model, the advisability of holding My Event is2.8600000000000003.Would you like to check again? YSelect the weather prediction model you wish to use: 1) Yesterdays weather. 2) Simple prediction. 3) Sophisticated prediction.> 2Enter how many days of data you wish to use for making the prediction: 4Based on the SimplePrediction model, the advisability of holding My Event is 5.Would you like to check again? YSelect the weather prediction model you wish to use: 1) Yesterdays weather. 2) Simple prediction. 3) Sophisticated prediction.> 3Enter how many days of data you wish to use for making the prediction: 12Based on the SophisticatedPrediction model, the advisability of holding My Eventis 5.Would you like to check again? NCSSE1001 / 7030 Semester 1, 2019TasksYou need to implement the Event, UserInteraction, EventDecision, SimplePrediction andSophisticatedPrediction classes. Method definitions are provided for some classes in theprediction.py and event_decision.py files. You may not change the interfaces (names,parameters or return type) of any of these methods. You may add other private instance variablesand methods to these classes to implement your logic and to structure your code.Event defines an object that holds data about a single event and provides access to that data. TheEvent constructor will take as parameters: name: a string representing the name of the event, outdoors: a Boolean value representing whether the event is outdoors, cover_available: a Boolean value representing whether there is cover available,time: an integer from 0 up to, but not including, 24, indicating the closest hour to the startingtime of the event.You need to implement the following methods: __init__ – Stores local references to the given parameters get_name – Returns the Event name get_time – Returns the integer time value get_outdoors – Returns the Boolean outdoors value get_cover_available – Returns the Boolean cover_available value __str__ – Returns a string representation of the Event in the following format:‘Event(name @ time, outdoors, cover_available)’One example might look like: ‘Event(Party @ 12, True, False)’UserInteraction defines an object that is the program’s user interface. Unlike the first assignment,you have some flexibility in how you display your prompts and results to the user. You need toimplement the following methods: get_event_details – Prompt the user to enter the data required to create an Event object,and return that object. The prompts need to be in the same order as shown in the exampleusage (event name, outdoors, shelter, time). The event name can be any string. If the eventis outdoors of if there is shelter should be indicated by the user entering either ‘Y’ or ‘Yes’,in any combination of lower or upper case characters. The UserInteraction object shouldstore a reference to the Event object, to be able to refer to it in other methods (e.g.output_advisability). get_prediction_model – An initial version of this method is provided. You need to extend itwhen you implement each new subclass of WeatherPrediction. The user needs to enter thedigit corresponding to their choice of prediction model. If the prediction model is the simpleor sophisticated prediction model, the user needs to then enter how many days of datashould be used by the model. The UserInteraction object should store a reference to theselected WeatherPrediction object, to be able to refer to it in other methods (e.g.output_advisability). output_advisability – Display the result of determining how advisable it is to continue withthe event. another_check – Ask the user if they would like to try using a different weather predictionmodel. The user needs to enter ‘Y’ or ‘Yes’ to indicate they want to perform another check.The user enters ‘N’ or ‘No’ to indicate they do not want to perform any more checks. Thismethod only asks if they want to try again and returns a bool value indicating their response.It does not call other methods to restart the prediction.CSSE1001 / 7030 Semester 1, 2019EventDecision defines an object that uses the predicted weather to determine the impact it willhave on an event. You need to implement the following methods: __init__ – Stores local references to the Event and WeatherPrediction objects passed asparameters. _temperature_factor – Returns the temperature factor which is determined by the followingsteps:1. The predicted temperatures may be adjusted based on the humidity. If the humidity isgreater than 70% a humidity factor is calculated by dividing the humidity value by 20.The humidity factor should be added to the high and low temperatures, if they arepositive; or subtracted from any temperature if it is negative.2. An initial temperature factor is calculated based on the following rules:a) If the time is between 6 and 19 inclusive and the event is taking place outdoors, andthe adjusted high temperature is greater than or equal to 30, then the temperaturefactor is the adjusted high temperature divided by -5 and then 6 is added to theresult.b) If the adjusted high temperature is greater than or equal to 45, regardless of timeor if the event is indoors or outdoors, the temperature factor is calculated using thesame formula (high temp ÷ -5 + 6).c) If the time is between 0 and 5 inclusive or 20 and 23 inclusive and the adjusted lowtemperature is less than 5, and the adjusted high temperature is less than 45, thenthe temperature factor is the adjusted low temperature divided by 5 and then 1.1is subtracted from the result (low temp ÷ 5 - 1.1).d) If the adjusted low temperature is greater than 15 and the adjusted hightemperature is less than 30, the temperature factor is the low temperaturesubtracted from the high temperature and the result divided by 5 ((high - low) ÷ 5).e) In all other cases, the initial temperature factor is 0.3. After calculating the initial temperature factor, if it is negative because of hightemperature (rules a or b) add 1 to the temperature factor for each of the followingconditions: There is cover available for the event. The wind speed is greater than 3 and less than 10. The cloud cover is greater than 4. _rain_factor – Returns the rain factor which is determined by the following steps:1. An initial rain factor is calculated based on the following rules.a) If the chance of rain is less than 20%, then the rain factor is the chance of raindivided by -5 and then 4 is added to the result (chance of rain ÷ -5 + 4).b) If the chance of rain is greater than 50%, then the rain factor is the chance of raindivided by -20 and then 1 is added to the result (chance of rain ÷ -20 + 1).c) In all other cases, the initial rain factor is 0.2. After calculating the initial rain factor: If the event is outdoors and cover is available, and the wind speed is less than 5, add1 to the rain factor. If the rain factor is less than 2 and the wind speed is greater than 15, then dividethe wind speed by -15 and add this result to the rain factor (rain factor + (wind speed÷ -15)). If the rain factor is less than -9 then set it to be -9. advisability – Returns the advisability ranking, which is calculated by the following:1. Add the final temperature factor and rain factor together. If the result is less than -5, setit to be -5. If the result is greater than 5, set it to be 5. Return this result as the advisabilityscore.CSSE1001 / 7030 Semester 1, 2019SimplePrediction defines an object that predicts the weather based on the average of the past ndays’ worth of weather data, where n is a parameter given to the class at construction. You need tooverride the methods defined in the WeatherPrediction class. __init__ – Retrieves and stores references to the past n days’ weather data. If n is greaterthan the number of days of weather data that is available, all of the available data is storedand used, rather than n days. get_number_days – Returns the number of days of data being used chance_of_rain – Calculate the average rainfall for the past n days. Multiply this average by9. If the resulting value is greater than 100, set it to be 100. Return this result. high_temperature, low_temperature – Each should return the highest/lowest temperaturerecorded in the past n days humidity and cloud_cover – Each should calculate the average of their data from the past ndays and return this result. wind_speed – Use only the average wind speed for the past n days, calculate the averagevalue and return this result.SophisticatedPrediction defines an object that predicts the weather based on the past n days’ worthof weather data, where n is a parameter given to the class at construction. You need to override themethods defined in the WeatherPrediction class. __init__ – Retrieves and stores references to the past n days’ weather data. If n s greaterthan the number of days of weather data that is available, all of the available data is storedand used, rather than n days. get_number_days – Returns n, the number of days of data being used chance_of_rain – Calculate the average rainfall for the past n days. If yesterday’s air pressurewas lower than the average air pressure for the past n days, multiply the average rainfall by10. If yesterday’s air pressure was higher than the average air pressure for the past n days,multiply the average rainfall by 7. After taking into account the air pressure, if yesterday’swind direction was from any easterly point (NNE, NE, ENE, E, ESE, SE or SSE) multiply theaverage rainfall by 1.2. If the resulting value is greater than 100, set it to be 100. Return thisresult. high_temperature – Calculate the average high temperature for the past n days. Ifyesterday’s air pressure was higher than the average air pressure for the past n days, add 2to the calculated average high temperature. Return this result. low_temperature – Calculate the average low temperature for the past n days. If yesterday’sair pressure was lower than the average air pressure for the past n days, subtract 2 from thecalculated average low temperature. Return this result. humidity – Calculate the average humidity for the past n days. If yesterday’s air pressure waslower than the average air pressure for the past n days, add 15 to the calculated averagehumidity. If yesterday’s air pressure was higher than the average air pressure for the past ndays, subtract 15 from the calculated average humidity. If the resulting value is less than 0or greater than 100, set it to be 0 or 100. Return this result. cloud_cover – Calculate the average cloud cover for the past n days. If yesterday’s airpressure was lower than the average air pressure for the past n days, add 2 to the calculatedaverage cloud cover. If the resulting value is greater than 9, set it to be 9. Return this result. wind_speed – Calculate the average of the average wind speed for the past n days. Ifyesterday’s maximum wind speed was greater than four times the calculated average windspeed, multiply the calculated average wind speed by 1.2. Return this result.When an object of any of the WeatherPrediction subclasses is created, it will store the weather datathat it will use to make its predictions. Loading new data into the WeatherData object will notupdate the data used by the WeatherPrediction object.CSSE1001 / 7030 Semester 1, 2019HintsThe focus of this assignment is on demonstrating your ability to implement a simple object-orientedprogram using objects, classes and inheritance. It is possible to pass the assignment if you onlyimplement some of the specified functionality. You should design and implement your program instages, so that after the first stage you will always have a working previous partial implementation.It is recommended that you start by implementing the Event class and then the EventDecision class.You can then implement the UserInteraction class. This will allow you to start using the program.The provided YesterdaysWeather class will give you an initial weather prediction model. You couldimplement the advisability method in EventDecision to initially return a random value withoutimplement the _temperature_factor and _rain_factor methods. This allows you to run the programand create an Event object, even though the logic does not do anything useful. After initially testingEvent, you should then implement advisability so that it uses _temperature_factor and _rain_factor.You can then implement the SimplePrediction class as your own weather prediction model. The laststage of development should be to implement the SophisticatedPrediction class.SubmissionYou must submit your assignment electronically through Blackboard. You need to submit both yourprediction.py and event_decision.py files (use these names – all lower case). You maysubmit your assignment multiple times before the deadline – only the last submission before thedeadline will be marked.Late submissions of the assignment will not be accepted. Do not wait until the last minute to submityour assignment, as the time to upload it may make it late. In the event of exceptional personal ormedical circumstances that prevent you from handing in the assignment on time, you may submita request for an extension. See the course profile for details of how to apply for an extension:https://www.courses.uq.edu.au/student_section_loader.php?section=5&profileId=98649Requests for extensions must be made no later than 48 hours prior to the submission deadline. Theexpectation is that with less than 48 hours before an assignment is due it should be substantiallycompleted and submittable. Applications for extension, and any supporting documentation (e.g.medical certificate), must be submitted via my.UQ. You must retain the original documentation fora minimum period of six months to provide as verification should you be requested to do so.Assessment and Marking CriteriaThis assignment assesses course learning objectives:1. apply program constructs such as variables, selection, iteration and sub-routines,2. apply basic object-oriented concepts such as classes, instances and methods,3. read and analyse code written by others,4. analyse a problem and design an algorithmic solution to the problem,5. read and analyse a design and be able to translate the design into a working program,6. apply techniques for testing and debuggingCSSE1001 / 7030 Semester 1, 2019Criteria MarkProgramming Constructs Program is well structured and readable Identifier names are meaningful and informative Algorithmic logic is appropriate and uses appropriate constructs Methods are well-designed, simple cohesive blocks of logic Object usage demonstrates understanding of differences between classesand instances Class implementation demonstrates understanding of encapsulation andinheritance�Sub-Total 6Functionality Event implemented correctly. EventDecision implemented correctly. SimplePrediction implemented correctly. SophisticatedPrediction implemented correctly.0.5�Sub-Total 6.5Documentation All modules, classes, methods and functions have informative docstringcomments Comments are clear and concise, without excessive or extraneous text Significant blocks of program logic are clearly explained by comments1.5�Sub-Total 2.5Total / 15Your total mark will be constrained if your program does not implement key functionality. Thefollowing table indicates a multiplier that will be applied to your programming constructs anddocumentation marks based on how much of the functionality your program correctly implements.The table assumes you followed the advice provided in the hints section of this document.Functionality Correctly Implemented MultiplierThe program does not pass any tests 0%Only Event passes tests 40%EventDecision._rain_factor orEventDecision._temperature_factor passes tests 60%All EventDecision methods pass tests 80%SimplePrediction passes tests 100%It is your responsibility to ensure that you have adequately tested your program to ensure that it isworking correctly.In addition to providing a working solution to the assignment problem, the assessment will involvediscussing your code submission with a tutor. This discussion will take place in week 10, in thepractical session to which you have signed up. You must attend your allocated practical session,swapping to another session is not possible.CSSE1001 / 7030 Semester 1, 2019In preparation for your discussion with a tutor you may wish to consider: any parts of the assignment that you found particularly difficult, and how you overcamethem to arrive at a solution; or, if you did not overcome the difficulty, what you would liketo ask the tutor about the problem; whether you considered any alternative ways of implementing a given function; where you have known errors in your code, their cause and possible solutions (if known).It is important that you can explain to the tutor the details of, and rationale for, yourimplementation.In the interview you must demonstrate understanding of your code. If you cannot demonstrateunderstanding of your code, this may affect the final mark you achieve for the assignment. Atechnically correct solution may not achieve a pass mark unless you can demonstrate that youunderstand its operation.A partial solution will be marked. If your partial solution causes problems in the Python interpreterplease comment out the code causing the issue and we will mark the working code. Python 3.7.2will be used to test your program. If your program works correctly with another version of Pythonbut does not work correctly with Python 3.7.2, you will lose at least all the marks for thefunctionality criteria.Please read the section in the course profile about plagiarism. Submitted assignments will beelectronically checked for potential plagiarism.CSSE1001 / 7030 Semester 1, 2019Detailed Marking CriteriaCriteria MarkProgramming Constructs 1 0.5 0 Program is well structuredand readableCode structure highlights logical blocks andis easy to understand. Code does notemploy global variables. Constants clarifycode meaning.Code structure corresponds to some logicalintent and does not make the code toodifficult to read. Code does not employglobal variables.Code structure makes the code difficult toread. Identifier names aremeaningful and informativeAll identifier names are informative, clearlydescribing their purpose, and aiding codereadability.Most identifier names are informative,aiding code readability to some extent.Some identifier names are not informative,detracting from code readability. Algorithmic logic isappropriate and usesappropriate constructsAlgorithm design is simple, appropriate, andhas no logical errors.Control structures are good choices toimplement the expected logic.Algorithm design is not too complex or hasminor logical errors.Most control structures are good choices toimplement the expected logic, but a fewmay be a little convoluted.Algorithm design is overly complex or hassignificant errors.Some control structures are used in aconvoluted manner (e.g. unnecessarynesting, multiple looping, …). Methods are well-designed,simple cohesive blocks of logicMethods have a single logical purpose.Parameters and return values are used welland do not break class encapsulation.Most methods have a single logical purpose.Parameters and return values are appropriateand rarely break class encapsulation.Some methods perform multiple functionaltasks or are overly complex.Parameters and return values are not usedappropriately or break class encapsulation. Object usage demonstratesunderstanding of differencesbetween classes andinstancesMethods, attributes and comments indicateeach class is treated as a definition of a typeand objects are used well in implementation.System behaviour is implemented in termsof objects sending messages to each other.Methods and attributes are based onprovided design and objects are mostlyused appropriately in implementation.Most behaviour is implemented in terms ofobjects sending messages to each other.Classes are treated as modules withfunctions, not as self-contained entities.Method implementations depend onexternal logic or variables. Class implementationdemonstrates understandingof encapsulation andinheritanceProvided class interfaces have not beenmodified, aside from adding new attributesand methods that complement the design.Attributes are only used inside of theirdefining class.Subclasses of WeatherPrediction conform toprovided definition and are well designed,cohesive, specialised models.Provided class interfaces have not beenmodified, aside from adding new attributesand methods.Attributes are only used inside of theirdefining class or subclasses.Subclasses of WeatherPrediction conformto provided definition.Provided class interfaces have beenmodified in ways detrimental to the design.Attributes are accessed directly fromoutside of their defining class.Subclasses of WeatherPrediction do notconform to provided definition.CSSE1001 / 7030 Semester 1, 2019Documentation 1.5 1 0.5 0 All modules, classes,methods andfunctions haveinformativedocstring commentsAll docstrings are accurate, complete& unambiguous descriptionsof how item is to be used.All parameters and return types,and expected values, are describedclearly.Almost all docstrings are accurateand reasonably clear descriptionsof how item is to be used.Almost all parameters and returntypes are described clearly.Almost all docstrings are accuratedescriptions of how item is to beused.Most parameters and return typesare described clearly.Some docstrings are inaccurateor unclear, or there are someitems without docstrings.Some parameters and returntypes, or expected values, are notclear. Comments are clearand concise, withoutexcessive orextraneous textMost comments provide usefulinformation that clarifies the intentof the code, making it easier tounderstand.Comments rarely repeat logicalready clear in code.Some comments are irrelevant,not providing any detail beyondwhat is obvious in the code.Comment style, or excessivelength, obscures some programlogic. Significant blocks ofprogram logic areclearly explained bycommentsImportant or complex blocks oflogic (e.g. significant loops orconditionals) are clearly explainedand summarised (i.e. stating a loopiterates over a list is not a usefulexplanation or summary).Some important or complexblocks of logic are explainedpoorly, or are not summarised.Some unimportant blocks of logicare described in too much detail.本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp