TCSS 305 Programming Practicum
作业GUI | uml代写 | Mvc | java代写 | project | unity | html | assignment代写 – 这是利用Mvc进行训练的代写, 对Mvc的流程进行训练解析, 是比较典型的GUI/uml/Mvc/java/unity/html等代写方向, 这个项目是assignment代写的代写题目
Programming assignment # 04
Revision History Rev. 0 ( 10 : 30 am on Wed, May 26 th, 202 1 ) Initial draft version.
Iteration 4 : Building a Polymorphic GUICalculator
In this iteration, you will replace the CLI (command-line interface) of your program with a GUI (graphical user interface,) improve the object-oriented design of the Bandwidth Calculator, refactor your codes to complete things that were incomplete in your last submission, and review and enhance your JUnit 5 tests to cover all computations and conversions of your calculator.
General Requirements
- You will continue to support the following web-based calculator programs: o https://www.calculator.net/binary-calculator. html o https://www.calculator.net/hex-calculator.html o https://www.calculator.net/bandwidth-calculator.html
Additionally, you will add two new calculators to the existing ones:
o A Decimal Calculator can add, subtract, multiply, and divide decimal number operands and return a
decimal number result. Note that decimal numbers, here, can represent integers and non-integers, such
as 3.14.
o A BigInteger Calculator can add, subtract, multiply, and divide BigInteger operands and return a
BigInteger result.
You will write a single program in java that supports the full functionality of all five calculators.
- Review the previous requirements document you submitted last time and update it to reflect the new and modified requirements.
The requirements list should include
o the prompts and menus to be shown to the user,
o the functions that will be implemented with their operand and result data types,
o the valid ranges/values for the operands and results, and
o the warning and error messages to be displayed in case of anomalies.
Document all your requirements clearly, not to miss any of them during your design/implementation. You can
choose your own way of documenting them: lists, tables, graphics, hand-written/-drawn, etc.
- Your program should validate all user inputs and reject the invalid entries/digits as early as possible with an appropriate error/warning message. However, this time accept the input values even if they would result in an overflow (i.e., the result does not fit into the given data type) upfront. Instead, your program should throw an exception in such cases, which you should catch and gracefully return the program to a stable state without crashing the program with a stack trace.
Design Constraints
- You should only use the object-oriented constructs of Java in your design/implementation and avoid any user- defined static methods, other than the main, in your implementation.
- As before, you should not use the available Java library methods to do the calculations and conversions directly, not to make the work trivial. One possible exception is that you can use library methods in computing the expected values in your JUnit test cases.
- Note that you can view all your classes at once in a uml Class Diagram using the IntelliJ IDEA EDU’s Diagrams
UML Class Diagram feature.
- You should use all the object-oriented constructs of Java language effectively: abstraction, encapsulation, inheritance, and polymorphism. You will need to give examples of how you have exploited each of them in your program as part of this assignment’s reflection questions. The assignment description helps you to satisfy this requirement automatically.
- Apply the Mvc architectural design pattern to your design. Review your classes and classify them according to their responsibilities, as model, view, and controller classes. Move your classes under the right packages (shown as file folders in your IntelliJ Java project.)
- Use the single-responsibility principle in your classes. Ensure that all your classes have a single and coherent, well-defined responsibility, as we did in the class. Model classes should be used to represent and manipulate numbers. Controller classes should be responsible for calculations and conversions, and View classes should only be used to interact with the user (i.e., input or output.)
- Use a multi-level inheritance hierarchy to represent your Calculator classes. This hierarchy will demonstrate the structural similarities and differences between different types of calculators. The calculators should also support the conversion methods but by implementing an interface rather than directly. Name the interface classes following Java naming conventions.
Hint: One of the design alternatives is given below. Feel free to make any improvements that you feel
appropriate to improve your design.
Hint: A possible solution is to define a parent class Calculator, its child classes NumericCalculator and
BandwidthCalculator, and other specific calculators as child classes of the NumericCalculator.
- The calculators should also support the conversion methods but by implementing an interface rather than directly. Name the interface classes following Java naming conventions.
Hint: For example, Binary to Decimal and Decimal to Binary should be methods defined in some
interface class (or classes) and implemented by the BinaryCalculator.
- Define a new custom data type (abstract data type (ADT)) to represent each different type of number (i.e., binary, hexadecimal, decimal, and BigInteger) that you manipulate as an operand or return from the calculator/conversion methods.
Your calculator methods in this iteration should only accept parameters and return values of these types instead
of integers or strings as you did before.
Use a multi-level inheritance hierarchy to represent your number classes, demonstrating the structural
similarities and differences of different types of numbers.
Hint: A possible solution is to define a parent class Number and its child classes BinaryNum, HexNum,
DecNum, BigIntNum. This multi-level inheritance hierarchy of number classes demonstrates the structural
similarities and differences of different types of numbers. Feel free to make any changes that you feel
appropriate to improve your design.
These number classes will allow your calculator/converter methods to accept arguments and return values of
these types, e.g., Binary add(BinaryNumber, BinaryNumber) takes two binary numbers and return another
binary number. If you have represented the binary numbers using Strings in PRGA#01-03, you can now replace
them with the BinaryNumber user-defined type and encapsulate a binary value designated as a String in the
BinaryNumber class.
- Revise Bandwidth Calculator design/implementation to use Enumerated Classes for representing the Units and ADTs for other concepts (like bandwidth and data/file size.)
Documentation Comments
- You should also use regular comments on a need basis to explain hard-to-understand code segments.
- Document your codes using Javadoc comments that describe your programs classes, interfaces, methods, and fields. You should also use regular comments on a need basis to explain hard-to-understand code segments.
3. Use IntelliJ IDEAs Inspect Code feature to see the status of your
JavaDoc comments. You should completely take care of these
warnings before you submit your code.
As part of your submission, you will submit a snapshot of your
Javadoc warnings before and after your improvements.
Implementation
- You should download and install the IntelliJ IDEA ULTIMATE edition – free with your UW email address. You will need some features of the full version in this and coming programming assignments.
Please see the Guidelines documents on installing IntelliJ IDEA - on the Pages page on Canvas - if you haven't
installed it yet. You may want to uninstall the Comm unity and EDU editions from your computer first to remove
some clutter and save your disk space.
- Use IntelliJ IDEAs Inspect Code feature to see the warnings list and try to take care of these warnings before you submit your code. Note that not all warnings may not be relevant or useful, select the ones you can do something about.
As part of your submission, you will submit a snapshot of your inspection results before and after your
improvements.
Hint: Please note that the automatic code inspection tool helps you to improve the Quality of your Codes.
Analyze your project codes by selecting from the menu: Analyze > Inspect code ... >
Testing
- Use the JUnit 5 (Jupiter) to automatically test all your calculation and conversion methods. The test coverage for them should be over 80%.
Use the Coverage plugin of IntelliJ to see your test coverage.
Note that some input values will raise exceptions since you will directly call the calculator/converter
methods instead of reading the operands from the user and filtering out the invalid inputs.
The test cases expected values for computations/conversio ns can be set manually or computed on-the-fly
using the available built-in Java library methods.
IntelliJ IDEA can automatically generate skeletons of your test classes and methods that you can use
initially: Go to the class that you would like to create a Test class for and press (Alt-Enter), accept the
defaults by pressing the OK button, and clicking on the displayed check boxes for all the methods of the
class, and then OK.
You should write the required assert statements yourself. You can then run the JUnit tests for the
application by clicking the Green Run icon Run with coverage.
Detailed Submission Instructions:
Part 1) Submit the pdf document that contains the requested information in the below-listed tasks:
Task 1 ) (Reflection)
Using 2-3 full sentences for each, list your three (3) important takeaways from this assignment.
________________________________________
Task 2 ) (Highlights on Technical Solution)
Using 3-5 full sentences for each, describe how you used/applied the following object-oriented
constructs/principles in your program:
- Abstraction – other than using abstract classes/methods
- Abstract Data Types (ADT)
- Polymorphic method implementation – using class inheritance or interfaces
- Single responsibility principle
Hint: Consider the object-oriented design of your binary, hexadecimal, decimal, BigInteger, and bandwidth calculators
after all your refactorings while answering this question.
________________________________________
Task 3 ) (Requirements)
Prepare a list of requirements for the program that you have implemented in this assignment.
Hint 1: You may think of this list as a checklist containing all the needs that you should address in your implementation.
Or some other programmer starting with this requirement list should be able to develop a similar program
independently without asking any further questions to you.
Hint 2: You can use any format, e.g., lists, tables, graphics, hand-written/-drawn, etc., you like, but try to limit your
answer to one page as much as possible.
Hint 3: The list of requirements should address the following questions; usually, a tabular format is a compact form
to fit everything in ~ one page:
- What types of inputs do you consider as invalid and reject in your program?
- How do you check for invalid inputs in your program?
- How do you inform the user about the invalid inputs s/he has entered? o Do the error/warning messages include some hints about how the user can correct the errors, such as displaying the valid set of characters and valid input ranges?
- In which cases do you throw an exception, and what types of exceptions do you throw?
_________________________________________
Task 4 a) (Design)
Use the IntelliJ IDEA Ultimate Editions Diagrams feature to display your programs structure in the form of a
UML Class Diagram.
You should take three snapshots/printouts of the Class Diagram with different levels of details: (each as one
page.)
- Display all fields, methods, associations, and dependencies of your classes.
- Display only the public fields and methods and the associations and dependencies of your classes.
- Display the GUI class that implements your program’s main frame, with all its superclasses (both classes and interfaces) up to the superclass Object with all its associations.
Hint: You should close the class dependencies' display and only show the associations between the classes since
showing the dependencies makes your diagram very dense in this case. To display a class's superclasses, right-click
on the class in the diagram and choose the Show Parents option.
Hint: You can present each diagram on a separate landscape-oriented page and make sure that all details are readable.
Or you can show the pieces of the diagram on different pages in an understandable manner.
Task 4 b) (Design)
Paste a snapshot of the IntelliJ IDEAs Project Panel View showing the Packages, Classes, Libraries, etc., that
displays your model, view, controller, and test classes under correct packages.
_________________________________________
Task 5 ) (Unit Testing)
Paste a snapshot of your JUnit test Coverage Panel View, showing that your unit tests have at least 80% code
coverage for your model and controller classes.
Hint 1 : You do not need to write test cases to test the GUIs, only the backend method implementations.
Hint 2: Expand the classes shown in the Coverage panel to make sure that it shows the coverage details for those classes
and their methods.
________________________________________
(Task 6 ) (Input Validation)
Paste a screen snapshot of at least three example cases that show how you handle the input errors in the menus
displayed to the user or during the input values' entry.
Give a brief explanation about how you implemented the input validation.
________________________________________
(Task 7 ) (Error Handling)
Paste a snapshot of at least three example cases that show how you handle the exceptions raised during the
calculations, such as division by zero or out-of-range results.
Give a brief explanation about how you implemented the exception handling.
_________________________________________
Part 2) Submit the zip file that contains your Implementation:
In IntelliJ IDEA, choose from the main menu File | Export | Project to Zip file … to export the
IntelliJ IDEA project folder containing your source codes, as well as your test codes, other required files for your program (such as image and data files, if any) as a compressed single zip file, with the name: prga#04-
lastname_firstname.zip.
Append your zip file as a comment to your submissions Assignment Comments after you submit your pdf file.