首页 > 其他分享 >PhysicalProduct Advanced class design

PhysicalProduct Advanced class design

时间:2024-12-01 20:33:21浏览次数:6  
标签:Classroom variables method instance Add design PhysicalProduct class

Task 1:In this assignment, you will write the code that manages the product categories on any website, such as Alibaba (Use another website). To get started:

  • Create a new Java project called Project1 in IntelliJ.
  • In the src directory, create a new class called AssignmentOne.
  • In the AssignmentOne class, create the main method.2

Assessment BriefModule 1 - Advanced class design The following part of the assessment covers the content in Module 1.Part 1 – Creating abstract classes and interfacesGo tothe website you choose and explore all the different categories of products that they sell. While you are doing this, have a look at thedifferent product categories as they go from more general to more specific. At the top level of the Inheritance hierarchy, you need a genericproduct. In your Java project:

  • Create a new interface called Product with at least two generic methods that are suitable for ALL product categories on the the websiteyou choose.Alibaba sells physical and digital products. Therefore, in the inheritance hierarchy, under products, you would need to handle physical productsand digital products. In your Java project:
  • Create an abstract class called PhysicalProduct that implements the interface called Product.
  • Create an abstract class called DigitalProduct that implements the interface called Product.The PhysicalProduct and DigitalProduct abstract classes must have the following at a minimum that are suitable for ALL physical OR digitalproduct categories on the Alibaba website:
  • At least two instance variables
  • A default constructor
  • A second constructor that sets all the instance variables
  • At least one abstract method
  • At least one non-abstract method
  • Any other methods or variables that you feel are necessary for the class to be usable in the program

Part 2 – Using abstract classes and interfacesOn the Alibaba website, choose one physical product category and one digital product category. In your project:

  • Create one concrete class that extends the PhysicalProduct abstract class.
  • Create one concrete class that extends the DigitalProduct abstract class.The classes should match the physical product category and digital product category you chose on the Alibaba site and have the following ata minimum:3Assessment Brief• At least two instance variables (one of these variables must be a boolean as a boolean instance variable is required in a later section oftheassignment)
  • A default constructor
  • A second constructor that initialises 代写 PhysicalProduct   Advanced class design  all the instance variables (including the instance variables in the abstract superclass)
  • A method that prints the Product details, e.g. "The product details are:" followed by all instance variables formatted for readability

(including the instance variables in the abstract superclass)

  • Any other methods or variables needed so that your products match the physical product category and digital product category you

chose on the Alibaba site.

For each class, in the class comments, you MUST provide a link to the product category on Alibaba that you based

your class on. In the main method:

  • Add the following comment - // Part 2 – Using abstract classes and interfaces
  • Create an object for the concrete class that extends the PhysicalProduct abstract class using the constructor that sets all instancevariables.
  • Create an object for the concrete class that extends the DigitalProduct abstract class using the constructor that sets all instancevariables.
  • Add the following code - System.out.println(" -------------------- ");Part 3 – PolymorphismIn the AssignmentOne class, write a method called demonstratePolymorphism that takes one parameter. The parameter type can be either a:

Product

  • PhysicalProduct
  • DigitalProductIn the main method:
  • Add the following comment - // Part 3 – Polymorphism
  • Add a second comment that explains how you are going to use the method you just created to demonstrate your understanding ofpolymorphism
  • Write the code to create an object and use the method you just created to demonstrate your understanding of polymorphism
  • Add the following code - System.out.println(" -------------------- ");4Assessment BriefNOTE: Do not remove the code in the main method for Part 2 (or any other part of the assignment). You can comment it out when you aredeveloping; however, when you submit your assignment, the main method must contain all the code required for all parts of the assignment, i.e.,your marker should be able to run your main method, and all parts of your assignment should run in one go.

Module 2 – Generics and lambdas

The following part of the assessment covers the content in Module 2.In Part 2 of this assessment, you created a concrete class that extends the PhysicalProduct abstract class. For the remainder of this assessment, this class will be referred to as yourClass as, in theory, all students should have a different name for this class.

Part 4 – Generic classesIn this part of the assignment, you are going to write the code for an ArrayList that can store instances (objects) ofyourClass. In the main method, write the code to:

  • Add the following comment - // Part 4 – Generic classes
  • Declare an ArrayList
  • Add at least 5 instances of yourClass to the ArrayList
  • Add the following code - System.out.println(" -------------------- ");

Part 5 – Generic methodsIn this part of the assignment, you are going to sort the ArrayList that we created in part 4.In yourClass, implement the Comparable interface. When you implement the compareTo() method from the Comparable interface, you must use at least two instance variables in the comparison.Once you have implemented the Comparable interface in the main method:

  • Add the following comment - // Part 5 - Generic methods
  • Write the code to sort the ArrayList that you created in Part 4.
  • Add the following code - System.out.println(" -------------------- ");

5Assessment BriefPart 6 – WildcardsIn the AssignmentOne class, create a method called DemonstrateWildcards that takes an ArrayList generic parameter <? extends T>. Inthe method, call one of the methods from PhysicalProduct abstract class.n the main method:

  • Add the following comment - // Part 6 - Wildcards
  • Add a second comment that explains how you are going to use the method you just created to demonstrate your understanding of wildcards
  • Write the code to create an object and use the method you just created to demonstrate your understanding of wildcards
  • Add the following code - System.out.println(" -------------------- ");

Part 7 – Simple lambda expressionsIn the AssignmentOne class, create a method called DemonstrateLambdas that takes an ArrayList of yourClass and a Predicate as aparameter. In the method, test the Boolean instance variable from yourClass and print a suitable message based on whether it is true or false.In the main method:

  • Add the following comment - // Part 7 - Simple lambda expressions
  • Write the code to pass the Arraylist that you created in Part 4 to the DemonstrateLambdas method
  • Add the following code - System.out.println(" -------------------- ");

6Assessment BriefTask 2

n this assignment, you will write the code that could form part of a management system for a school.To get started:

  • Create a new Java project called Project2 in IntelliJ.
  • In the src directory, create five classes called:

o Person

o Staff

o Member

o Classroom

o AssessmentTwo

In the system you are creating:

  • The Staff class is used to track the School staff, e.g., trainers, reception, etc.
  • The Member class is used to track the School members.
  • The Classroom class is used to track the classes offered at the School, e.g., Math, English, OOP, etc.

In the Person class:

  • Add at least 3 instance variables suitable for a person
  • Add a default constructor and a second constructor that sets the instance variables using parameters
  • Add getters and setters for all Person instance variables

In the Staff class:

  • Extend the Person class
  • Add at least 2 instance variables suitable for School staff7Assessment Brief• Add a default constructor and a second constructor that sets the instance variables (Staff and Person) using parameters
  • Add getters and setters for all Staff instance variables
  • In the Member class:
  • Extend the Person class
  • Add at least 2 instance variables suitable for a School member
  • Add a default constructor and a second constructor that sets the instance variables (Member and Person) using parameters
  • Add getters and setters for all Member instance variablesIn the Classroom class:
  • Add at least 3 instance variables suitable for a Clasrooms. One of these instance variables must be of type Staff, i.e. used to track the trainerrunning the Classroom.
  • Add a default constructor and a second constructor that sets the instance variables using parameters.
  • Add getters and setters for all Classroom instance variables.

In the AssessmentTwo class add the following code:

public class AssessmentTwo {

public static void main(String[] args) {

}

public void partOne(){

}

public void partTwo(){

}

public void partThree(){

}

public void partFour(){

}

public void partFive(){

}

public void partSix(){

}

}

8Assessment BriefModule 3 - Advanced Collections The following part of the assessment covers the content in Module 3.Part 1 – Lists

The Classroom class is missing the ability to store a collection of Members who have signed up for the Classroom. For this part of the assignment:

  • Using a LinkedList, update Classroom so that a Classroom object can store a collection of Members (i.e. datatype Member) who have signed up fortheClassroom.In addition to adding a LinkedList, you need to add the following methods to Classroom that work with the LinkedList:
  • A method to add a Member to the Classroom.
  • A method to check if a Member is in the Classroom.
  • A method to remove a Member from the Classroom.
  • A method that returns the number of Members in the Classroom.
  • A method that prints the details of all Members signed up for the Classroom (you must use an Iterator or you will get no marks).

Note: Make sure all the above methods print suitable success/failure messages.DemonstrationIn the partOne method in the AssessmentTwo class:Create a new Classroom object.

  • Using the methods you created:

o Add a minimum of 5 Members to the LinkedList.

o Check if a Member is in the LinkedList.

o Remove a Member from the LinkedList.

o Print the number of Members in the LinkedList.

o Print all Members in the LinkedList.9Assessment BriefPart 2 – Collection ClassThere is no way to sort the Members who have signed up for a Classroom. For this part of the assignment:

  • Create a class (you can choose the name) that implements the Comparator interface. When you implement the compare method from the Comparatorinterface, you must use a minimum of two of the instance variables in your comparison.
  • Create a method in the Classroom class that sorts the LinkedList using the sort(List list, Comparator c) method in the Collections class.Note: You MUST use the Comparator interface. You CAN NOT use the Comparable interface.

DemonstrationIn the partTwo method in the AssessmentTwo class:

  • Create a new Classroom object.
  • Using the methods you created:

o Add a minimum of 5 Members to the LinkedList.

o Print all Members in the LinkedList.

o Sort the LinkedList

o Print all Members in the LinkedList again to show that the LinkedList has been sorted.Part 3 – Queue InterfaceAs most School classes would have a maximum number of members that can sign up, the program needs the ability to keep track of Members whoare waiting to join the School class and the order in which they joined the waiting list, i.e., first in first outFor this part of the assignment:

  • Using a Queue, update the Classroom class so that a Classroom can store Members (i.e., Member objects) who are waiting to join the Classroom.In addition to adding a Queue, you need to add the following methods to the Classroom class that work with the Queue:
  • A method to add a Member to the Queue.
  • A method to remove a Member from the Queue.
  • A method that prints all the details for all Members in the Queue in the order they were added.Note: Make sure all the above methods print suitable success/failure messages.10Assessment BriefDemonstrationIn the partThree method in the AssessmentTwo class:
  • Create a new Classroom object.
  • Using the methods you created:

o Add a minimum of 5 Members to the Queue.

o Remove a Member from the Queue.rint all Members in the Queue.11

Assessment BriefSubmissionSubmission ZIP file via USB drive (U盘) (Name+ Complete student number + Assignment 1)

  • Project 1
  • Project 2
  • A 10 minutes video explain Project 1 and Project 2Assessment Criteria
  • Java code compiles with Java 17 LTS.
  • Use of correct coding style, including the use of comments.
  • Accuracy of coding.
  • Use of suitable coding structures.
  • Correct submission and naming conventions of assessment items as required.12Assessment Brief

标签:Classroom,variables,method,instance,Add,design,PhysicalProduct,class
From: https://www.cnblogs.com/CSE231/p/18577984

相关文章

  • [Design Pattern] Encapsulate a network request lib - 4. API Template
    Whencompany'sAPIbecomehugeandalwayschanging,if request-busismaintainedbydevelopersmanually,it'snotonlytimeconsumingbutalsoerrorprone.Wecanintroducesomestandardautomationprocesstoresolvetheproblem. Examples:{......
  • [Design Pattern] Encapsulate a network request lib - 1. DIP: Dependence Inversio
    ThreelayersdesignLowlevelimplementationLayer:usinglowlevelimplementationtocompletebasicoperation.Forthenetworkrequest,wecanusethelibsuchasaxios,whichinternallyusing xhr,orwecanalsouse fetchdirectlyfromnode.jsreque......
  • 带过滤功能的Material Design风格手风琴列表特效
    这是一款带搜索过滤功能的MaterialDesign风格垂直手风琴列表特效。该手风琴特效采用扁平设计风格,点击列表项时带有点击波效果,并且可以通过顶部的搜索框来搜索过滤需要的列表项。在线演示  下载  使用方法使用该手风琴特效需要在页面中引入jquery-accordion-menu.css文......
  • 【Altium Designer 25.0.2下载与安装教程】
    1、安装包「AltiumDesignerv25.0.2.28.rar」链接:https://pan.quark.cn/s/babcbc39d4b1提取码:EPis2、安装教程(建议关闭杀毒软件和系统防护)1)       下载并解压下载的安装包,右击Installer.exe安装,弹窗安装对话框  2)       点击Next   3)   ......
  • SpectralFormer: Rethinking Hyperspectral Image Classification with Transformers
    摘要:高光谱(HS)图像以其连续的光谱信息而著称,能够通过捕捉细微的光谱差异来精细识别物质。由于其出色的局部上下文建模能力,卷积神经网络(CNNs)已被证明是HS图像分类中的强大特征提取器。然而,由于其固有网络骨架的限制,CNNs未能很好地挖掘和表示光谱签名的序列属性。为了解决这......
  • Type definition error: [array type, component type: [simple type, class java.lan
     详细报错信息:Typedefinitionerror:[arraytype,componenttype:[simpletype,classjava.lang.String]];nestedexceptioniscom.fasterxml.jackson.databind.exc.InvalidDefinitionException:Cannotconstructinstanceof`java.lang.String[]`:noString-argu......
  • Qt Design Studio常用组件及其属性
    入坑QtDesignStudio        笔者此前一直使用的是Qtcreator与其内置的Qtdesigner进行客户端界面设计和开发,采用的是qwidget+c++的设计方法,由于项目需要进行3D设计,转而学习使用QtDesignStudio,发现qml代码简单,布局直观,对新手更为友好,开发上手快速。因此,后续也会在......
  • css中class和id选择器有什么区别?
    在CSS中,class和id选择器都是用来选择HTML元素并应用样式的,但它们之间有一些关键的区别:1.多次使用:class:可以应用于多个HTML元素。这意味着你可以将相同的样式应用于页面上的不同元素。例如,你可以将class="highlight"应用于多个段落,使它们都具有相同的突出显示......
  • Step-05 SFT微调一个2-Classification模型
    一、B二、E微调(finetuning)过程中主要调整输出层(例如替换为二分类头)以适应具体任务。是否需要冻结其他层的参数取决于任务的需求:仅替换输出头:可用于轻微调整模型,使其专注于新任务的分类。部分冻结层:通过冻结Transformer主体参数(阻止梯度更新)保持预训练时学到的基础知识,......
  • 【java编程】Xalan ClassLoader
    Xalan是Java中用于操作XML的一个库,它是ApacheXML项目的一部分,主要用于将XSLT(ExtensibleStylesheetLanguageTransformations)转换为可执行代码,从而实现XML文档的转换。XSLT的理解当然了,我们先理解该模块如何使用之后,我们再研究它的妙用,XSLT说白了就是将XML+......