PROG2004 ObjectOriented Programming

news/2024/12/14 20:55:52/文章来源:https://www.cnblogs.com/CSE2425/p/18607062

Assessment BriefPROG2004 ObjectOriented Programming

Module 4 – Advanced exception handling The following part of the assessment coversthe content in Module 4.Part 4 – Implementing exception handlingAt the moment, you have not implemented any exception handling in your program. For this part of the assignment:

  • Where applicable, make sure that all setters in your program confirm that the values they are writing to your instance variables are valid. If they arenot, throw an IllegalArgumentException and print an appropriate error message.
  • Add any other exception handling that you feel is appropriate to your program.

Demonstrationn the partFour method in the AssessmentTwo class:Using one of the setters that you added exception handling to:

o Pass a valid value to the method and show that the instance variable is set

o Pass an invalid value to the method and show that the exception is caught

Title Assessment 2 (Continue from Project 2 from theprevious Assessment)  Deadline 11:30 AM, 16 December 2024 Submission

Code + Video using a USB driveModule 5 – Input/output The following part of the assessment coversthe content in Module 5.

An important part of many programs is the ability to back up data to a file and then restore it as needed. In this section of the assignment, we will add thisability to our program.

Hint for exporting and importing data

A common way to store data in a file that needs to be imported later is to use comma-separated values (csv). This means that we store a record on a single

line, and we separate values using a comma (,). For example, imagine an object for a class called Animal has the following information:

  • species: Dog
  • breed: Poodle
  • colour: Brown
  • name: Fido
  • age: 7

You could store the Animal object in the file on代写PROG2004 ObjectOriented Programming  a single line like:Dog, Poodle, brown, Fido, 7When you read the file, each line in the file will contain the details for a single Animal object. You can then use the split() method from the String classto splitthe line into the individual values and then use the values to create a new Animal object.

Part 5 – Writing to a file

The Classroom classis missing the ability to back up the Members who have signed up for the Classroom. Forthis part of the assignment:

  • Add a method to the Classroom class that writes the details of all of the Members that have signed up for the Classroom (i.e. stored in theLinkedList) to a file. The details for each Member should be written on their own line.
  • Youmust make sure to add all appropriate exception handling and error messages.DemonstrationIn the partFive method in the AssessmentTwo class:2Assessment Brief• Create a new Classroom.
  • Add a minimum of 5 Members to the Classroom (i.e., the LinkedList).
  • Export the Members to a file.

Part 6 – Reading from a file

The Classroom class is also missing the ability to restore the members who have signed up for the Classroom. For this part of the assignment:

  • Add a method to the Classroom class that can read the file that was created in the previous section.
  • When reading the file, you need to sign up all members for the Classroom (i.e., add them to theLinkedList). You must make sure to add all appropriate exception handling and error messages.

Note: If you cannot enrol the Members in the Classroom (i.e., add them to the LinkedList), you will still get marks for reading the file.

Demonstration

In the partSix method in the AssessmentTwo class:

  • Create a new Classroom.
  • Importthe file you created in the previous part of the assignment.
  • Print the number of Members in the LinkedList to confirm that the correct number of Members were imported.
  • Print all Members in the LinkedList to confirm that the details of each Member were imported correctly.

Module 6 – Concurrency

The following part of the assessment coversthe content in Module 6.Part 7 – lock() and unlock() methodsYou are using a LinkedList to store the Members signed up for a Classroom. However, a LinkedList is not thread-safe. This meansthat if multiple threads wereperforming operations on the Members signed up for a Classroom you could encounter issues. For this part of the assignment:

  • Use the lock() and unlock() methods to protect any critical sections of code in the Classroom class that perform any operations on the LinkedListthat stores the Members signed up for a Classroom.
  • Youmust make sure to add all appropriate exception handling and error messages.
  • Assessment BriefResourcesTo complete the task, you are recommended to:
  • Study modules 1 - 6 materials and complete all learning activities
  • Take an active role in the weekly tutorial and workshop.Task SubmissionYou are required to submittwo items for this assessment, including:
  • Your Java project 2 (after updating it)
  • A 5 minutes video explain the new parts.Assessment CriteriaPlease refer to the rubric provided in the assessment folder for the assessment criteria. Marking criteria include:
  • Java code compiles with Java 17 LTS
  • Use of correct coding style, including the use of comments
  • Accuracy of coding
  • Use ofsuitable coding structures
  • Correctsubmission and naming conventions of assessment items asrequiredAssessment Brief

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/852658.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

2024-2025-1 20241403《计算机基础与程序设计》第十二周学习总结

2024-2025-1 20241403《计算机基础与程序设计》第十二周学习总结 作业信息这个作业属于哪个课程 <班级的链接>(如2024-2025-1-计算机基础与程序设计)这个作业要求在哪里 <作业要求的链接>(如2024-2025-1计算机基础与程序设计第一周作业)这个作业的目标 指针与一维…

我的新博客 MarisaMagics Blog

新博客地址 MarisaMagics Blog 最近用 github + hexo 配置了一个新的博客,以后可能基本上都在新博客平台上更新文章 DA⭐ZE ~一切都是命运石之门的选择,本文章来源于博客园,作者:MarisaMagic,出处:https://www.cnblogs.com/MarisaMagic/p/18607182,未经允许严禁转载

locust 压力测试工具windows平台从零开始安装使用

locust是一个用python写的接口压力测试应用,我们只需要编写简单的代码才能运行测试,前期安装需要一点python基础。 用以测试的接口需要一个一个通过代码添加,如下: 这就是一个测试的接口了,很简单,只需要接口的路径和参数,接口的主机地址会在web端输入: locust需要pyth…

OpenDaylight下发流表

实验一:单流表(v1.0) 下发流表实现h1和h2之间不能互通。 1、启动OpenDaylight ./karaf查看6633端口是否处于监听状态 netstat -an | grep 6633在物理机浏览器中访问虚拟机ip:8181/index.html登录OpenDaylight网页端。 账号密码都是admin。后面做实验的时候,出现过无法登录的…

深度学习入门笔记——神经网络的构建和使用

神经网络的整体构建 神经网络的基本骨架 首先可以在Pytorch官网的Python API中查看torch.nn的使用,如下所示。可以看到神经网络包括Container(基本骨架)、卷积层、池化层、Padding层、非线性激活等等。 构建一个神经网络首先要先构建起基本骨架,也就是Containersnn.Moudle的…

计算机做的所有事情都叫计算

计算机怎么解决问题?答:需要告诉计算机解决问题的步骤(不要写成说明书了) 怎么告诉计算机这个步骤?答:编程语言写程序 1. 写程序不是表达关系,是表达动作2. 是解决问题的步骤,编程的时候不是你说一句它做一句3. 编程语言不是用来和计算机交流的4. 计算机的交流是你的操…

第四章 文件管理

文件 4.1.1 文件的基本概念文件是指由创建者所定义的、具有文件名的一组相关元素的集合,是以硬盘为载体的存储在计算机上的信息集合 是文件系统中最大的数据单位 在用户进行的输入,输出中,则以文件为基本单位4.1.5 文件的逻辑结构 按文件是否有结构分类 无结构文件 文件内部…

程序执行两种方式

1.你写的程序交文件给它,它一步步按照你的要求执行 2.写的程序文件交给它,它翻译成计算机懂的文件,用计算机懂的文件执行 解释语言vs编译语言1. 语言本身没有解释和编译的区分,任何语言都可以编译执行和解释执行。2. 只是语言常用执行方式的传统和习惯的问题3. 解释语言 特…

P1070 [NOIP2009 普及组] 道路游戏

ProblemSolve 此题是求最优解,考虑贪心时会发现这个不满足局部最优->整体最优,故考虑DP 通过输入格式能受到启发,时间可以作为维度之一,所以定义为: \(f_{i,j}\)第i秒末,机器人在j号工厂能获得的最大金币 因为机器存在时间有上限,所以推的时候枚举本次机器人到底走了多…

2024-12-14:K 周期字符串需要的最少操作次数。用go语言,给定一个长度为n的字符串 word 和一个整数k,k是n的因数。每次操作可以选择两个下标i和j,使得i和j都可以被k整除,然后用从j

2024-12-14:K 周期字符串需要的最少操作次数。用go语言,给定一个长度为n的字符串 word 和一个整数k,k是n的因数。每次操作可以选择两个下标i和j,使得i和j都可以被k整除,然后用从j开始的长度为k的子串替换从i开始的长度为k的子串。要使得word成为一个K周期字符串,需要进行…

实现综合实例:简单文字处软件 (一)

学业繁重,更新缓慢。 本内容主要用于个人学习/复习QT简单入门控件 DAY ONE 创建项目界面设计与开发 实现简单的菜单栏设计本人并没有使用代码实现,而是用于使用UI设计师界面。action条例分类 设计控件(帮助) 设计帮助控件: 我们转到槽,填写如下代码: 这是一个基于QT6实现…