美文网首页
讲解:COMP122、Java、Java、cryptograph

讲解:COMP122、Java、Java、cryptograph

作者: liaoyie | 来源:发表于2020-01-12 21:22 被阅读0次

    COMP122 Assessment 3Graphical User InterfacesDue 2019-05-02 at 5pmCOMP122 Assessment 3 Due 2019-05-02 at 5pmA GUI for a new cryptographic routineYour employer has patented a brand new and super secure encryption algorithm and you are taskedwith building a flashy UI for end-users to help the marketing department turn it into gold.You are told that the encryption mechanism uses an integer as secret key when translating plain texts tocrypto texts and back. Both encryption and decryption are done using the same method, called rotate.To encrypt a plain text string plaintext with key k (an int), you would pass both values as parametersto this function: cryptotext = rotate(plaintext, k); Conversely, decoding works very muchthe same way, but using the inverse key as follows: plaintext = rotate(cryptotext, -k);To comply with recent governmental regulations, and to make some extra money, your employerdecided to additionally include a back-door – a separate routine that allows to deduce plain texts fromcrypto texts without knowing the secret key.Both crypto-routines are implemented as methods of a class called Caesar, but the implementationdetails are proprietary and above your pay grade. So instead of the source code of this class, you areonly given an interface called RotationCipher (see the UML diagram below and also the javadoccomments in RotationCipher.java) that declares the two routines.>RotationCipher+ rotate(s : String, n: int) : String+ decipher(s : String) : StringAdditionally, you are given a file called Caesar.class that contains the compiled bytecode of theCaesar class, which implements this interface, and which you can instantiate in your code to accessthe crypto-routines.RequirementsYou are tasked to write a graphical user interface based on the Swing toolkit that allows users to encryptand decrypt text using the new method.a. Write a Java program called CaesarGUI that allows users to encrypt and decrypt text. You canadd any JComponent widgets you like but as a minimum there should be a JFrame window to hold all other components JTextFields (or similar components) for the plain text, the integer key, and crypto text. a JButton for the user to click on and trigger the conversion appropriate JLabels to identify the above.2COMP122 Assessment 3 Due 2019-05-02 at 5pmWhen the button is clicked, your program should read the input plain text and integer key o� therespective components, call the rotate method and update the component for the crypto text.b. Document your design. Where in your code do you instantiate the Caesar class? How dothe di�erent component depend on each other (who creates who)? Describe your design in aseparate report (a PDF). Good documentation would include javadoc and in-line comments at anappropriate level (don’t document every line of code). You should also add an UML class diagramthat displays all component classes and their attributes/methods that you used in your code.c. (Bonus) Add some way of validating the input of the integer key. Acceptable solutions would beif, in case the input cannot be parsed as an integer, the text field turns red, a warning pop-up orsome status line displays an error message. Yo代写COMP122留学生作业、代写Java程序设计作业、代做Java课程设计作业、代写cryptographic rouu may also use (or write) Component classes thatmake it impossible for users to input non-integers. Document your design choices.d. (Bonus) Write another GUI, similar to the one above, that uses Caesar.decipher to decipherencrypted text without the secret key.Hints As mentioned in the lectures, it is good practice (but not required) to define your main windowas subclass of JFrame and assemble the components in its constructor. To react to the user clicking on your button, you will want to write an ActionListener (a classthat implements this interface) and register an instance of this listener class with the button. Thisis the Controller part of your Model-View-Controller program. Have a look at the code examplesin lecture 17 to see how to do this. To get or set the content of a TextField, use its methods getText() and setText() withsignatures as below. See the API docs on oracle.com for more.1 public String getText();2 public void setText(String s); For part c) remember the input validation we discussed as examples for exception handling inlectures 11 & 12. You may use java.io.Scanner or java.lang.Integer’s parseInt method,which takes a String, returns an int and possibly throws a NumberFormatException.1 try{2 int i = Integer.parseInt(text)3 }4 catch ( NumberFormatException e ){ ... }3COMP122 Assessment 3 Due 2019-05-02 at 5pmSubmission Instructions Deadline: Thursday, 2 May 2019, 5:00pm Submission server: https://sam.csc.liv.ac.uk/COMP/Submissions.plYour submission should be a single compressed .zip file called comp122_assessment_3_SID.zipwhere SID should be replaced by your student ID. This file should include:1. Your implementation. This must include the .java source files. Put everything into a subfoldercalled ‘src’, including the interface and class file you received for the exercise.2. A report in .pdf format. You can structure this report as you like and do not need to have thesame formal structure nor pseudo-code as in A1.Marking SchemeEach part counts towards the final mark of this coursework as follows.a b c d50% 30% 10% 10%To get full marks for parts c) and d) you need to include documentation, not just the implementationalone. You do not need to include a full UML class diagram for part d) but it’d make sense to have onediagram that covers a) and c).If your code does not compile and run on departmental computer systems you will su�er a penalty of5%. The same applies if your submission does not exactly follow the submission instructions regardingfile name and type.Your submission is an individual piece of work. No collaboration with other students is allowed!Expect that plagiarism detection so�ware will be run on your submission to compare your work tothat of other students. Late submissions and plagiarism/collusion are subject to the University Codeof Practice on Assessment, available here1. In particular, since these are online submissions, a latepenalty of 5% applies for every 24h period a�er the deadline.Notice that I will not grant extensions requested a�er the submission deadline!1https://www.liverpool.ac.uk/media/livacuk/tqsd/code-of-practice-on-assessment/code_of_practice_on_assessment.pdf4转自:http://www.7daixie.com/2019042612619769.html

    相关文章

      网友评论

          本文标题:讲解:COMP122、Java、Java、cryptograph

          本文链接:https://www.haomeiwen.com/subject/sxpwactx.html