首页 > 其他分享 >Dictionary application using Swing

Dictionary application using Swing

时间:2024-12-01 18:54:52浏览次数:5  
标签:word Dictionary assignment should application words Swing need

Assignment 4: Dictionary

Logistics  The assignment is meant to be done individually.The deadline for this assignment is 11:59 PM on Dec 2, 2024, Pacific Time.Academic dishonesty is unacceptable and will not betolerated in this course.Last Modified: Nov 15, 2024

General Description

In this assignment, you need to build a dictionary application using Swing. The application has the following features. Users can:add new words, new meanings to the wordsreplace an old word with a new one, without changing its original meaning and its frequencyremove words from the dictionary and check if a word is in the dictionarycount the frequency of searches for each word.display the most frequent words based on the prefix they provide.display the search historyImport and export words in batchIn detail, your dictionary should have the following functionalities:Users should be able to add, remove and modify words.Users should be able to check if a certain word is in the dictionary and retrieve its meaningsUsers should be able to see the three most frequent words that can complete their given keyword.e.g., for uni , it should return universe , university , universal .e.g., for apple , Input format:Output format:For export, please export the words in the (descending) order of frequencyWe ensure that no word will have the same frequency in grading test cases.Exception Handling

In this assignment, you need handle 4 kinds of exceptions:InvalidWordError : the word entered to add/find/clear is not a worBy mentioning word , we define it as a String consisting of a-z and A-Z

WordNotFoundError : the word is not found in our dictionary.WordDuplicatedError : the word to be added has existed in the dictionary.FileNotFoundError : the file path provided does not exist when importing or exporting from a txt file.

Definition of Exceptions

In order to raise those 4 exceptions, please define them by inheriting the RuntimeException class.Once needed, you need to:you need to:First, throw the related exceptionThen,display texts to notify that an error has occurred.Notice: For grading, we will test only one error for each exception-handling test case.

Layout Example for Dictionary

Recommended Procedure for Implementation

  1. Create a project named Dictionary
  2. Create a package under src named Dictionary
  3. Create a form under packagewith the name. Check create bound class 3. Create a form under package Dictionary with the name Dictionary.form . Check create bound classand it will automatically createDictionary.javaOn Dictionary.form , design the GUI of Dictionary. In particular, you should (at least) have the followingcomponents as you can see in the figure we show above:
  1. FINDButton

Note: only increase the frequency counts of the top 3 words.The words feasible to be searched should include the keyword.Display the top 3 (or 2 or 1) words in the TextFreqWord1 , TextFreqWord2 , TextFreqWord3fields in the (descending) order of frequencyIf there are fewer than 3 words to display,please leave those TextFreqWord fields empty.

  1. ADDButton
  2. MODIFYButton

Note: replace the old word with the new one, but keep its original meaning and frequency.

  1. REMOVEButton
  2. CLEARButton
  3. IMPORTButton
  4. EXPORTButton
  5. TextNewWord : where you type in the word you want to add/find/remove
  6. TextOriginalWord : where you type in the frequency you want to modify
  7. TextFreqWord1 , TextFreqWord2 , TextFreqWord3 : 3 TextFields to display frequent words in findingprocedure
  1. TextArea : where:
  2. word meanings are displayed
  3. error messages are displayed
  4. searchHistoryList : a JList where show the search history
  5. xTextFilePath : where you type in the path of import ot export

Be careful: The names of the components should be the same as showed above. Don't forget to

consider and handle 4 self-defined exceptions during implementation!

  1. Define 4 self-defined exceptions mentioned above using inheritance of RuntimeException .
  2. Implement the Action Listens for all the buttons.
  3. Test your code and see if the GUI works smoothly and has the expected functionality.

SampleTest Please notice that SampleTest is just to help you understand the whole assignment more easily. Sample tests

are only for clearer explanation and simple testing during your implementation. Passing all the sample tests are only for clearer explanation and simple testing during your implementation. Passing all the sample testsdoes not mean you will get a full score. You need to read the description carefully, and think it

comprehensively when implementing this assignment.After you complete the assignment following the recommended procedures listed above, you could thefollowing SampleTest code to test if your implementation 代写Dictionary application using Swing workssmoothly:package Dictionary;You could find input.txt and output_ref.txt mentioned in SampleTest on Canvas.To run the SampleTest , you may need to change all the attributes into public instead of private .Submission During implementing this assignment:

Please follow the steps in general description A simple way to check if you are following the steps is to run the sample tests. If every sample test runssmoothly and gets passed, then you are fine.Fail to obey this rule may lead to reduction of your final score!

You need to submit your hw on both Gradescope and Canvas.You need to submit a JAR on Gradescope file for autogradingAfter you complete this assignment, zip up this project folder into Dictionary.zip . After yougenerate the JavaDoc, also put a screenshot of the JavaDoc in the zip file. Please do not submit .rar file. Then upload it to Canvas under Assignment 4 submission linkTo build the JAR file, please follow:Create an artifact configuration for the JARFrom the main menu, select File | Project Structure and click Artifacts.Click +, point to JAR and select From modules with dependencies.To the right of the Main Class field, click and select Dictionary in the dialog that opens. IntelliJDEA creates the artifact configuration and shows its settings in the right-hand part of the ProjectStructure dialog.Apply the changes and close the dialog.Build the JAR artifactFrom the main menu, select Build | Build Artifacts.Point to Dictionary:jar and select Build.If you now look at the out/artifacts folder, you'll find your JAR thereRubrics

 

标签:word,Dictionary,assignment,should,application,words,Swing,need
From: https://www.cnblogs.com/CSE231/p/18579755

相关文章

  • Deploying LLM Applications with LangServe
    DeployingLLMApplicationswithLangServehttps://www.datacamp.com/tutorial/deploying-llm-applications-with-langserve Deployingalargelanguagemodel(LLM)intoproductioncantransformyourapplication,offeringadvancedfeaturesinnaturallanguage......
  • Qt运行生成的exe报错“This application failed to start because no Qt platform plu
    Qt运行生成的exe报错“ThisapplicationfailedtostartbecausenoQtplatformplugincouldbeinitialized.Reinstallingtheapplicationmayfixthisproblem.”报错复现将exe复制一份至单独文件夹中,直接运行会发现报错缺少一些dll去Qt根目录D:\QT\Qt\5.15.0\mingw8......
  • Error starting ApplicationContext. To display the conditions report re-run your
    ErrorstartingApplicationContext.Todisplaytheconditionsreportre-runyourapplicationwith'debug'enabled.2024-11-2815:35:25.856ERROR12216---[     main]o.s.b.d.LoggingFailureAnalysisReporter : ***************************A......
  • 浅析C# Dictionary实现原理
    目录一、前言二、理论知识1、Hash算法2、Hash桶算法3、解决冲突算法三、Dictionary实现1.Entry结构体2.其它关键私有变量3.Dictionary-Add操作4.Dictionary-Find操作5.Dictionary-Remove操作6.Dictionary-Resize操作(扩容)6.1扩容操作的触发......
  • Swing布局
    1.流式布局(FlowLayout)   按照水平方向依次排列组件,排满一行后继续换行排列;排列方向从左到右,或者从右到左,这取决于容器的componentOrientation属性;   参数:FlowLayout.LEFT左对齐FlowLayout.CENTER居中对齐FlowLayout.RIGHT右对齐FlowLayout.LEA......
  • 请描述下application cache的更新过程?
    ApplicationCache,或者说是AppCache,是一个已经被废弃的HTML5特性,用于离线存储网页资源。由于其更新机制复杂且容易出错,它已经被ServiceWorkers和CacheAPI取代。尽管如此,如果您仍然需要了解其更新过程,以下是其工作原理:manifest文件检查:浏览器会定期检查manifest......
  • 黑马头条Day4-19启动ApArticleApplication时报错some of the beans in the applicatio
    文章目录1.错误呈现2.错误原因3.解决方案(注入ApArticleService改成注入ApArticleMapper)视频教程:黑马程序员Java项目实战微服务项目《黑马头条》开发全套视频教程,基于SpringBoot+SpringCloud+Nacos等企业级微服务架构项目解决方案1.错误呈现APPLICATIONFAILED......
  • 某某大学校园一卡通项目(模拟)Swing + mysql + thread
     CardServerpackagecom.shrimpking.t4;importjavax.swing.*;importjava.awt.*;importjava.io.IOException;importjava.net.ServerSocket;importjava.net.Socket;/***CreatedbyIntelliJIDEA.**@Author:Shrimpking*@create2024/10/2210:47......
  • Springboot启动失败问题:Application run failed(jdk原因)
    以下代码报错ErrorstartingApplicationContext.Todisplaytheconditionsreportre-runyourapplicationwith'debug'enabled.2024-10-1921:56:55.234ERROR16584---[main]o.s.boot.SpringApplication:Applicationrunfailed......
  • [java/spring/web] 深入理解:Spring @ExceptionHandler => 自定义应用异常处理器(Appli
    1概述:Spring@ExceptionHandler∈spring-web作用ExceptionHandler是Spring框架(spring-web模块)提供的一个注解,用于处理应用程序中的异常。当应用程序中发生异常时,ExceptionHandler将优先地拦截异常并处理它,然后将处理结果返回到前端。该注解可用于类级别和方法级别,以......