Assignment Chef icon Assignment Chef

Browse assignments

Assignment catalog

33,401 assignments available

[SOLVED] Cmsc 412 homework 2

Write a C program for UNIX that creates three processes, a grandparent (G), a parent (P) and a child (C). The first process is the grandparent G, which creates the process P (the parent) and then waits until P finishes its execution. Process P in turn, will create the child process C and waits until C finishes its execution. More precisely, the following list describes the behavior of each process: 1. Process G will create process P, will wait for process P to finish its execution, and then will display its own pid. 2. Process P will create process C, will wait for process C to finish its execution, and then will display its own pid and the pid of process G (its parent). 3. Process C will display its own pid, the pid of process P (its parent) and the pid of process G (its grandparent) When run, the program will display the following (where X, Y, Z are numbers representing process ids): I am the child process C and my pid is X. My parent P has pid Y. My grandparent G has pid Z. I am the parent process P and my pid is Y. My parent G has pid Z. I am the grandparent process G and my pid is Z.

$25.00 View

[SOLVED] Cmsc412 – final project cmsc – operating systems

Design and implement a Demand Paging virtual memory simulator! It must be a text based application (NOT a GUI based one). You can use the C/C++ or Java programming language. The following algorithms must be implemented: FIFO, OPT, LRU and LFU. The application must simulate the execution of each of these algorithms on a hypothetical computer having only N physical frames (numbered from 0 to N-1, N

$25.00 View

[SOLVED] Cmsc204 – thread lab cs204 myers

Start with the Car, CarPanel and CarFrame provided.Add a CarQueue class that maintains a queue of random directions that the car should go. 1. There is an addToQueue method that has a class that implements runnable, define the run method (add random directions into the queue and then sleep), creates an instance of the runnable object, creates a thread and starts the thread. /** Adds 0,1,2 or 3 to queue * 0 = up * 1 = down * 2 = right * 3 = left */2. It also has a deleteQueue method that returns an Integer;3. In your constructor, place 5 or 6 numbers in the queue so that when the animation starts – there will be something to retrieve from the queueModify the run method of the startAnimation in CarPanel so that the car will go to the right, left, up or down depending on what is retrieved from the CarQueue. The cars should go in the opposite direction if they hit a boundary.

$25.00 View

[SOLVED] Cmsc 204 recursion lab

Write a recursive method to sum the values in an array of integers. Create a file ArraySum.java and add the recursive method public int sumOfArray (Integer[] a,int index). Note that ‘a’ is an array of type Integer that is specified in the driver file, and ‘index’ is an integer that shows which number in the array to sum next. Use the driver class ArraySumDriver.java to populate your array and demonstrate that your method works. Load the files ArraySum.java and ArraySumDriver.java to GitHub and take a screen shot. Upload your ArraySum.java, ArraySumDriver.java and your GitHub screen shot to Blackboard.

$25.00 View

[SOLVED] Cmsc204

Generic Lab Start with the DataSet class and make it into a generic DataSetGen class. This class should load any instance of a class that implements Measurable, and no classes that do not implement Measurable. Test it with the DataSetTester. The DataSetTester uses the BankAccount and BaseballPlayer classes. Do not change any of the classes except DataSet. Upload the original DataSet.java, DataSetTester.java, BankAccount.java, BaseballPlayer.java, and Measurable.java in a directory named GenericLab, into your repository in GitHub from Lab 1. Upload DataSetGen.java into the same directory.

$25.00 View

[SOLVED] Cmsc204 –

In this project you will be creating an application to maintain a network of towns and the roads connecting them. The application will use Dijkstra’s Shortest Path algorithm to find the shortest distance between any two towns. Upload the initial files and your working files to the repository in GitHub you created in Lab 1, in a directory named Assignment6.Implement Graph Interface Use Graph to maintain a network of Vertices Implement Shortest Path AlgorithmData Element – Town (Vertex) Create a Town class that holds the name of the town and a list of adjacent towns, and other fields as desired, and the traditional methods (constructors, getters/setters, toString, etc.). It will implement the Comparable interface. This is the class header: public class Town implements Comparable Two towns will be considered the same if their name is the same. Data Element – Road (Edge) Create a class Road that can represent the edges of a Graph of Towns. The class must implement Comparable. The class stores references to the two vertices(Town endpoints), the distance between vertices, and a name, and the traditional methods (constructors, getters/setters, toString, etc.), and a compareTo, which compares two Road objects. Since this is a undirected graph, an edge from A to B is equal to an edge from B to A. This is the class header: public class Road implements ComparableData Structure – Graph, implements GraphInterface Create a Graph class that implements the GraphInterface given you. For Graph, V is the vertex type (a Town), E is the edge type (a Road). You will need to decide how to store the graph, use an adjacent matrix or an adjacency list. This is the class header: public class Graph implements GraphInterface Within the Graph interface is a method shortestPath, which finds the shortest path from a given source Town to a destination Town. Since there is a unique shortest path from every vertex to the source, there is a back-pointer to the previous vertex. The method shortestPath calls dijkstraShortestPath which finds the shortest path from the source to every other vertex in the graph. You will be coding the Dijkstra’s Shortest Path algorithm. You will then be able to find the connections between two towns through the roads that connect them. weighted graph which means that the edges have a weight, and this is used to determine the shortest path. For this implementation, each weight will be the distance of the road in miles. Data Manager – implements TownGraphManagerInterface Your TownGraphManager will hold an object of your Graph. Implement the TownGraphManagerInterface. There are methods to populate the graph (reading from a text file), add a town (vertices), add a road (edge), list all towns and all roads, and list towns adjacent to a given town. Your solution will find the shortest path from a start town to a destination town. It will account for the possibility of a disjoint graph (i.e., not all vertices can be reached from all other vertices.)Exception Classes FileNotFoundException – created and thrown when the selected input file is not found. IOException – created and thrown when user selects an input file that cannot be read (check out the methods of File). Note that these exceptions exist in the Java API. GUI Driver (provided for you) The GUI has four sections: a Town section where you can add towns, a Road section where you add roads, a Find Connection section, and an administration section. It has a Read File button, which allows the text files provided to be read and populate the graph.Testing 1. Your completed implementation must pass the TownGraphManagerTest.java and the GraphTest.java. 2. The tests marked GFA (“Good Faith Attempt”) are the minimal testing that must pass in order for your implementation to meet the good faith attempt. 3. Create a JUnit Test – TownGraphManager_STUDENT_Test. Test all the methods of the TownGraphManager with a different set of data than the TownGraphManagerTest provided for you. 4. Create a JUnit Test – Graph_STUDENT_Test. Test all the methods of the Graph with a different set of data than the GraphTest provided for you. 5. Create a Junit Test – Road_STUDENT_Test. Test all the methods of your Road class. 6. Create a Junit test – Town_STUDENT_Test. Test all the methods of your Town class.Populating the Data Structure You will be reading from a data file. You are provided with two sample files: MD Towns.txt and US Towns.txt along with two PowerPoint slides showing these graphs.The Towns.txt files hold the information for the individual Towns and Roads, and is in the following format: road-name,miles;town-name; town-name For example: I-94,282;Chicago;Detroit Notice that the road-name and miles are separated by a comma, while the road information and the two towns are separated by semi-colons.After reading these files, you will have an initial set of vertices and edges in your Graph.The GUI (Provided for you) The GUI will have four sections: an Add Town section, an Add Road section, a Find Connection section, and an administration section. There will be four ComboBoxes each containing the same list of Towns. On startup the graph will be empty.Add a Town Button Add a Road Button To add a road, a town must be selected from each of the two ComboBoxes in the Add Road section, an integer distance entered, and a road name entered. When the Add Road button is selected, the edge is created and entered in the graph.Find Connection Button Display all the available towns in the ComboBoxes (in alpha order by name). When the user selects the towns, display the name in the ComboBoxes. When the user selects the “Find Connection” button, the TownGraphManager’s shortestPath method is called. The resulting list of roads connecting towns, and the distance along each road, is displayed in the text area.If the “source” town and “destination” town are the same, or if there is no route between the two, state that in the text area. Read File Button The Towns.txt files hold information for individual Towns and Roads, and is in the following format: road-name,miles;town-name;town-name For example: I-94,282;Chicago;Detroit Notice that the road-name and miles are separated by a comma, while the road information and the two towns are separated by semi-colons.Exit Button The program will terminate.Deliverables / Submissions: Design: UML class diagram with algorithm (pseudo-code) for methods Implementation: Submit a compressed file containing the follow (see below): The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below. Be sure to review the provided project rubric to understand project expectations. The write-up will include: • UML diagram • In three or more paragraphs, highlights of your learning experienceDeliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats: • LastNameFirstName_Assignment4_Complete.zip, a compressed file in the zip format, with the following: o Write up (Word document) – reflection paragraphs o Final Design: UML Diagram – latest version (Word or jpg document) o Screen shot of GitHub repository with final set of files. o doc (directory) – Javadoc • File1.html (example) • File2.html (example) o src (directory) • File1.java (example) • File2.java (example)• LastNameFirstName_Assignment4_Moss.zip, a compressed file containing one or more Java files: o File1.java (example) o File2.java (example) This folder should contain Java source files only

$25.00 View

[SOLVED] Cmsc204 – lab 4 – networking chat room

Lab Objectives • Be able to create server and client sockets • Be able to create input and output streams to and from sockets • Be able to create threads • Be able to run an object in a threadIntroduction Everyone is familiar with chat rooms. In this lab we are going to create a server/client infrastructure that supports multiple users sending messages to each other. In this lab you will not need to build the user interface, or to design the class structure. You will be given most of the class structure and will focus on creating instances of classes that run inside threads, and on creating sockets and in- and out-streams with which to communicate. First, we need a blueprint. Here is the basic class diagram:Let’s look more closely at each class. 1. GUI. The user interface is a set of classes providing the basic interface to start a server, start each client, and exit the application. You will not need to edit this code. 2. ChatServerExec. The sole responsibility of the ChatServerExec is to implement the method startServer. This class implements the ChatServerExecInterface. You will be editing this class to put the server in a thread and start the thread. The ChatServer is placed in its own thread so the GUI can operate asynchronously. The ChatServerExec then exits, while the ChatServer continues to operate. 3. ChatServer. The responsibility of this class is to create the server socket, listen for each client, and set up in- and out-streams. It then ensures that each client submits a unique screen name and adds the name to the set of client names. Finally, it creates a server to respond to the individual client and places it in a thread. The ChatServer than continues its loop to listen for the next client. 4. ServerThreadForClient. This server responds to an individual client. When its client sends it a message, this server is responsible for sending out that message to each outstream, i.e., to each client. Note that this is an inner class. 5. ChatClientExec. Just like the ChatServerExec, this class is responsible for implementing startClient, which involves running the ChatClient instance in a thread. This class implements the ChatClientExecInterface. 6. ChatClient. This class is responsible for building its own window (code provided) as a separate GUI. You will create a client socket with server address and port and set up in- and out-streams to the server. The class then follows the application protocol. This involves first getting a screen name from the user, and then receiving messages from the clients via the ServerThreadForClient instances and posting the message in its textarea. When this client sends a message, the user enters it into the window’s textfield whereupon it is sent to its ServerThreadForClient. ChatClient implements ChatClientInterface. 7. Upload the initial files in GitHub in the repository you created in Lab 1, and modify them as you implement the solution. Take a screen shot of the repository and submit it.Task #1 Starting a Thread 1. In ChatServerExec, create a thread containing the server instance, and start the thread. 2. In ChatServer, create a server socket. Also uncomment the System.out.println so that the console reflects that a server was started. 3. When you run the GUI, you will be able to start the server, and launch clients, but will not be able to enter anything in the client’s textfield. Task #2 Creating In- and Out-Streams 1. Inside the ChatServer while loop, listen for a client to join, and when one does, create an in- and an out-stream. 2. Compile and run, but you will still not be able to enter messages. Task #3 Creating the Client 1. In ChatClientExec, create a thread containing the client instance, and start the thread. 2. In ChatClient’s run method, create a client socket with server address and server port. 3. In ChatClient’s run method, set up in- and out-streams. Task #4 Running the application 1. Compile and run. 2. Start the server first. 3. Then start a client. Enter a screen name. 4. Start a second client, with a unique screen name. 5. Send messages by entering in a client’s textfield. 6. Take a screen shot of two clients running and chatting.

$25.00 View

[SOLVED] Cmsc204 –

Assignment DescriptionWrite the classes required to create a Morse Code Converter Utility. Your Morse Code Converter Utility will be using a generic linked binary tree with generic TreeNodes to convert Morse Code into English. There is no GUI requirement for this assignment. You are supplied a GUI for testing purposes.Concepts tested by this assignmentGeneric Classes Utility Class (all static methods) Linked Trees Building a Tree for conversion purposesData Element – TreeNode classData Structure – MorseCodeTree class A generic linked binary tree which inherits from the LinkedConverterTreeInterface. Utility class – MorseCodeConverter The MorseCodeConverter contains a static MorseCodeTree object and constructs (calls the constructor for) the MorseCodeTree. This class has two static methods convertToEnglish to convert from morse code to English. One method is passed a string object (“.-.. — …- . / .-.. — — -.- …”). The other method is passed a file to be converted. These static methods use the MorseCodeTree to convert from morse code to English characters. Each method returns a string object of English characters. There is also a static printTree method that is used for testing purposes – to make sure the tree for MorseCodeTree was built properly. Use the Javadoc provided to make sure that your MorseCodeConverter class follows the method headers so that the MorseCodeConverterTest will run correctly. Testing – JUnit Test Classes You must add at least 1 test for MorseCodeConverter.convertToEnglish(String) and at least 1 test for MorseCodeConverter.convertToEnglish(File) to the MorseCodeConverterTest class. You must create a JUnit test for your MorseCodeTree class. Include your test files with your code files.Assi gnment DetailsThis is a table for the conversion from Morse Code to alpha letters.Building the MorseCodeTree (method buildTree) Your MorseCodeTree is a 4 levels tree. Insert a mapping for every letter of the alphabet into the tree map. The root is a TreeNode with an empty string. The left node at level 1 stores letter ‘e’ (code ‘.’) and the right node stores letter ‘t’ (code ‘-‘). The 4 nodes at level 2 are ‘i’, ‘a’, ‘n’, ‘m’ (code ‘..’, ‘.-‘, ‘-.’, ‘—‘). Insert into the tree by tree level from left to right. A ‘.’ will take the branch to the left and a ‘-‘ will take the branch to the right. This is the structure of the tree.Using the MorseCodeTree Use the MorseCodeTree to convert Morse Code to English by taking the code and finding it’s corresponding English letter by traversing the MorseCodeTree, ‘.’ branches to the left and ‘-‘ branches to the right. The code ‘.–.’ would branch to the left, then to the right, then to the right, then to the left to Fetch the letter ‘p’. Each letter is delimited by a space (‘ ‘). Each word is delimited by a ‘/’.Some suggestions: 1. There is a morse code translator at: http://morsecode.scphillips.com/jtranslator.htmlThis will help you build files and test cases for your JUnit Tests.Test Cases: Hello WorldHow do I love thee let me count the waysDeliverables / Submissions: Design: UML class diagram with algorithm (pseudo-code) for methods Implementation: Submit a compressed file containing the follow (see below): The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below. Be sure to review the provided project rubric to understand project expectations. The write-up will include: • UML diagram • In three or more paragraphs, highlights of your learning experienceDeliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats: • LastNameFirstName_Assignment4_Complete.zip, a compressed file in the zip format, with the following: o Write up (Word document) – reflection paragraphs o UML Diagram – latest version (Word or jpg document) o doc (directory) – Javadoc • File1.html (example) • File2.html (example) o src (directory) • File1.java (example) • File2.java (example)• LastNameFirstName_Assignment4_Moss.zip, a compressed file containing one or more Java files: o File1.java (example) o File2.java (example) This folder should contain Java source files only

$25.00 View

[SOLVED] Cmsc204 –

Assignment DescriptionMost data is stored in databases, for ready access and organization. Our course data is backed up by IT in databases which makes our data easy to access and use.Write a program that creates a database of courses. It will either read from a file of courses, or allow the user to add one course at a time. Upload the initial files and your working files in the repository in GitHub you created in Lab 1, in a directory named Assignment4. Take a screenshot of your repo, and post the assignment to the Assignment 4 dropbox.Concepts tested by this assignmentHash Table, Link List, hash code, buckets/chaining, exception handling, read/write files using FileChooserData Element – CourseDBElement,Data Structure – CourseDBStructure Implements the CourseDBStructureInterface that is provided. You will be implementing a hash table with buckets. It will be an array of linked lists of CourseDBElements. Each CDE will have a hash code that comes from the CRN, since the CRN is unique for courses. Note that the CRN is an int, and the tests require the hashcode of a string, so you will need to coerce it to a String, and take the hash code of the resulting string. The add method will take a CourseDBElement and add it to the data structure. If a linked list at the relevant hash code doesn’t exist, create a LinkedList with the first element being the CDE and add it to the HashTable. If the LinkedList already exists, add the CDE to the existing list. Two constructors for the CDS will be required, one that takes in an integer that is the estimated number of courses, the other is used for testing purposes. The comments in the CourseDBStructureInterface (provided) should help you figure out how to set the length of the hash table. You will not need to use the 4k+3 code.Data Manager – CourseDBManager Implements the CourseDBManagerInterface that is provided. The data manager allows the user to read the courses from a file or to enter the data by hand, and uses an Alert to print out the database elements. The input is read from a file or read from the textfields and is added to the data structure through the add method. The add method uses the CDS add method. The CourseDBManager is also referred to as a CDM.Exception Classes IOException – created and thrown when user selects an input file that cannot be read or attempting to retrieve a CDE that does not exist in the DB.GUI Driver (provided) • User will only create a course database once they have entered an input file or entered one or more sets of attributes. • Buttons and textfields are grayed out if they are not relevant at the current time. • A FileChooser is used to select the input and output files. • Inform the user if there is an error with the input file. • Use exception handling for the validity of the files. • A way is provided for the user to “clear” the text fields. • A way is provided for the user to select a CRN and retrieve the corresponding course.Testing Create a JUnit Test – CourseDBManager_STUDENT_Test.Assi gnment DetailsThere will be two ways to create a course database. The first requires a document to be read from an input file. The second reads the input from five textfields. Once there is data in the database, the GetCourse button will be enabled to allow you to see the data. See the example below.Select the input file button and navigate to the file.Use ShowDB button to display the CDEs that were read:Example of Creating a CDE from text fields. First select the other radio button, then fill in the textfields, then select the “Add to DB” button.Select the Show DB button to see the resulting CDEs.Example of retrieving a CDE. First select the GetCourse button. Three components at the bottom of the screen will become enabled. Then fill in the CRN and select the FindCourse button to find the applicable course from the database.The general design is shown here to guide you in formulating your own design:Deliverables / Submissions: Design: UML class diagram with algorithm (pseudo-code) for methods Implementation: Submit a compressed file containing the follow (see below): The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below. Be sure to review the provided project rubric to understand project expectations. The write-up will include: • UML diagram • In three or more paragraphs, highlights of your learning experienceDeliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats: • LastNameFirstName_Assignment4_Complete.zip, a compressed file in the zip format, with the following: o Write up (Word document) – reflection paragraphs o GitHub repository with java files from Assignment 4. o Final Design: UML Diagram – latest version (Word or image) o doc (directory) – Javadoc • subdirectories (as is) • File1.html (example) • File2.html (example) o src (directory) • File1.java (example) • File2.java (example)• LastNameFirstName_Assignment4_Moss.zip, a compressed file containing one or more Java files: o File1.java (example) o File2.java (example) This folder should contain Java source files only

$25.00 View

[SOLVED] Cmsc204 –

Assignment DescriptionYour assignment is to write a generic double singly-linked list class with an iterator, and a generic sorted double singly-linked list class with an iterator that inherits from your generic double singly-linked list class. The GUI has been provided for you for this assignment to help you visualize your linked list. Your list classes will also be tested with Junit tests. Upload the initial files from Blackboard and your working files in a directory into the repository in GitHub you created in Lab 1 and take a screen shot of the files.Concepts tested by this assignmentException handling Generic Classes Double Linked List Ordered Double Linked List Iterators ComparatorsClassesBasicDoubleLinkedListThis generic double singly-linked list relies on a head (reference to first element of the list) and tail (reference to the last element of the list) where the last node points to the first element of the list. Both the head and the tail are set to null when the list is empty. Both point to the same element when there is only one element in the list, and now the element’s “next” reference points to itself. A node structure has only two fields: data and the next references. The class must only define the following entities: an inner class Node, an inner class that implements ListIterator (for the iterator method), head and tail references and an integer representing the list size. However only the next(), hasNext(), previous() and hasPrevious() methods of the ListIterator are you required to implement. The rest of the methods can throw the UnsupportedOperationException, such as: public void remove() throws UnsupportedOperationException{ throw new UnsupportedOperationException();} All the entities are defined as protected so they can be accessed by the subclass. Follow the Javadoc that is provided.SortedDoubleLinkedList A generic sorted double linked list will be constructed using a provided Comparator to determine how the list is to be sorted. It extends BasicDoubleLinkedList class. The addToFront and the addToEnd methods will not be supported and an add method will be added that inserts to the double linked list in sorted order dependent on the Comparator. Follow the Javadoc that is provided.Exception Handling • UnsupportedOperationException – this exception is a Java library exception and will be returned by the addtoFront and addToEnd implementations of the SortedDoubleLinkedList class and by the remove method of the iterator. • NoSuchElementException – this exception is a Java library exception and will be returned by the next function within the iterator class when there are no more elements in the linked list.GUI driver (provided for you) A GUI driver has been provided for you to help you visualize your doubly-linked lists. Here is the minimum that must be in place to start using the GUI driver effectively. • All methods in your BasicDoubleLinkedList and SortedDoubleLinkedList must be stubbed. • The addToFront or addToEnd method of the BasicDoubleLinkedList must be implemented to create a basic double singly-linked list. • The add method of the SortedDoubleLinkedList must be implemented to create a sorted double singlylinked list. • The toArrayList method in both the BasicDoubleLinkedList and SortedDoubleLinkedList, which returns an arraylist of the items in the list from the head of list to the tail of list. This method is used to display the contents of the lists.Testing 1. Your code should cause the BasicDoubleLinkedList_Test tests to succeed. 2. Your code should cause the SortedDoubleLinkedList_Test tests to succeed. 3. Create a JUnit Test – BasicDoubleLinkedList_STUDENT_Test. 4. Create a JUnit Test – SortedDoubleLinkedList_STUDENT_Test.Adding to a Basic List Adding to a Sorted ListRemoving Second from basic Removing Thomas from sortedStart the iterators for Basic and Sorted. Think of iterators being “in between” nodes.Example of selecting “Next” for Basic and then for Sorted list. Think of iterators being “in between” nodes.Example of “Next” for basic and “Previous” for Sorted. Think of iterators being “in between” nodes.Deliverables / Submissions: Design: UML class diagram with algorithm (pseudo-code) for methods Implementation: Submit a compressed file containing the follow (see below): The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below. Be sure to review the provided project rubric to understand project expectations. The write-up will include: • Final design: UML diagram with pseudo-code • In three or more paragraphs, highlights of your learning experienceDeliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats: • LastNameFirstName_Assignment3_Complete.zip, a compressed file in the zip format, with the following: o Write up (Word document) – reflection paragraphs o UML Diagram – latest version (Word or jpg document) o doc (directory) – Javadoc • File1.html (example) • File2.html (example) • Sub-directory (example) o src (directory) • File1.java (example) • File2.java (example)• LastNameFirstName_Assignment3_Moss.zip, a compressed file containing one or more Java files: o File1.java (example) o File2.java (example) This folder should contain Java source files only

$25.00 View

[SOLVED] Cmsc204 –

CMSC 204 Assignment #2 NotationInfix notation is the notation commonly used in arithmetical and logical formulae and statements. It is characterized by the placement of operators between operands – “infixed operators” – such as the plus sign in “2 + 2”. Postfix notation is a notation for writing arithmetic expressions in which the operands appear before their operators. There are no precedence rules to learn, and parentheses are never needed. You will be creating a utility class that converts an infix expression to a postfix expression, a postfix expression to an infix expression and evaluates a postfix expression.Concepts tested: Generic Queue Generic Stack Exception handlingData Element StringData Structures 1. Create a generic queue class called NotationQueue. NotationQueue will implement the QueueInterface given you. You will be creating NotationQueue from scratch (do not use an internal object of the Queue class from java.util) 2. Create a generic stack class called NotationStack. NotationStack will implement the Stack Interface given you. You will be creating NotationStack from scratch (do not use an internal object of the Stack class from java.util)Utility Class The Notation class will have a method infixToPostfix to convert infix notation to postfix notation that will take in a string and return a string, a method postfixToInfix to convert postfix notation to infix notation that will take in a string and return a string, and a method to evaluatePostfix to evaluate the postfix expression. It will take in a string and return a double. In the infixToPostfix method, you MUST use a queue for the internal structure that holds the postfix solution. Then use the toString method of the Queue to return the solution as a string. For simplicity sake: a. operands will be single digit numbers b. the following arithmetic operations will be allowed in an expression: + addition – subtraction * multiplication / division Exception Classes Provide the following exception classes: 1. InvalidNotationFormatException – occurs when a Notation format is incorrect 2. StackOverflowException – occurs when a top or pop method is called on an empty stack. 3. StackUnderflowException – occurs when a push method is called on a full stack. 4. QueueOverflowException – occurs when a dequeue method is called on an empty queue. 5. QueueUnderflowException – occurs when a enqueue method is called on a full queue.ALGORITHMSInfix expression to postfix expression:Read the infix expression from left to right and do the following:If the current character in the infix is a space, ignore it. If the current character in the infix is a digit, copy it to the postfix solution queue If the current character in the infix is a left parenthesis, push it onto the stack If the current character in the infix is an operator, 1. Pop operators (if there are any) at the top of the stack while they have equal or higher precedence than the current operator, and insert the popped operators in postfix solution queue 2. Push the current character in the infix onto the stack If the current character in the infix is a right parenthesis 1. Pop operators from the top of the stack and insert them in postfix solution queue until a left parenthesis is at the top of the stack, if no left parenthesisthrow an error 2. Pop (and discard) the left parenthesis from the stack When the infix expression has been read, Pop any remaining operators and insert them in postfix solution queue.Postfix expression to infix expression:Read the postfix expression from left to right and to the following:If the current character in the postfix is a space, ignore it. If the current character is an operand, push it on the stack If the current character is an operator, 1. Pop the top 2 values from the stack. If there are fewer than 2 values throw an error 2. Create a string with 1st value and then the operator and then the 2nd value. 3. Encapsulate the resulting string within parenthesis 4. Push the resulting string back to the stack When the postfix expression has been read: If there is only one value in the stack – it is the infix string, if more than one value, throw an errorEvaluating a postfix expressionRead the postfix expression from left to right and to the following:If the current character in the postfix expression is a space, ignore it. If the current character is an operand, push on the stack If the current character is an operator, 1. Pop the top 2 values from the stack. If there are fewer than 2 values throw an error 2. Perform the arithmetic calculation of the operator with the first popped value as the right operand and the second popped value as the left operand 3. Push the resulting value onto the stack When the postfix expression has been read: If there is only one value in the stack – it is the result of the postfix expression, if more than one value, throw an errorGrading Rubric – CMSC 204 Project #2Name _____________________________ .PROGRAMMING (100 pts) Compiles 40 pts _____ Accuracy Passes public JUnit tests 15 pts _____ Passes STUDENT JUnit tests 10 pts _____ Execution: runs without errors (either run-time or logic errors) 20 pts _____ Possible Sub-total 100 pts _____ REQUIREMENTS (Subtracts from Programming total) Documentation: Javadoc was not provided for all student generated classes – 5 pts _____ Documentation within source code was missing or incorrect – 5 pts _____ Description of what class does was missing Author’s Name, @author, was missing Methods not commented properly using Javadoc @param, @return JUnit STUDENT methods were not implemented -5 pts _____ Learning Experience (text document) -4 pts _____ In 3+ paragraphs, highlight your lessons learned and learning experience from working on this project. What have you learned? What did you struggle with? What would you do differently on your next project?Programming Style: Incorrect use of indentation, statements, structuresDesign: Classes do not have the functionality specified, i.e., -10 pts _____ 1. Data Structures classes • Generic Stack class • Generic Queue class – 16 pts_____ 2. Utility class – Notation • Does not follow provided Javadoc -15 pts_____ • Does not correctly handle exceptions Possible decrements: -60 pts _____ Possible total grade: 100 pts _____

$25.00 View

[SOLVED] Cmsc204

Assignment 1 PasswordsConcepts tested by this program: ArrayList static Read Files Javadoc JUnit Tests ExceptionsCreate an application that will check for valid passwords. The following rules must be followed to create a valid password.1. At least 6 characters long 2. 10 or more characters is a strong password, between 6 and 9 characters is a weak (but acceptable) password. 3. At least 1 numeric character 4. At least 1 uppercase alphabetic character 5. At least 1 lowercase alphabetic character 6. At least 1 special character 7. No more than 2 of the same character in a sequence Hello@123 – OK AAAbb@123 – not OK Aaabb@123 – OKSpecial Characters: Special characters are a selection of punctuation characters that are present on standard US keyboard and frequently used in passwords. Character Name Space! Exclamation Double quote ”Character Name # Number sign (hash) Dollar sign $% Percent Ampersand &’ Single quote Left parenthesis () Right parenthesis Asterisk *+ Plus Comma ,– Minus Full stop ./ Slash Colon :; Semicolon Less than ? Question mark At sign @[ Left bracket Backslash] Right bracket Caret ^_ Underscore Grave accent (backtick) `{ Left brace Vertical bar |} Right brace Tilde ~Operation: When the application begins, the user will be presented with a screen that states the above instructions for creating a password, two text entry boxes for typing in a password, and three buttons. If the user wants to check a single password, they will type in the password in both boxes and select the “Check Password” button. If the user wants to read in and check a list of passwords, they will select the “Check Passwords in File” button, be presented with a file explorer, and select the file to read from. Those passwords that failed the check will be displayed, with their error message. Specifications:The Data Element String The Data Structure ArrayList of Strings Utility Class 1. Create a PasswordCheckerUtility class based on the Javadoc given you. 2. The PasswordCheckerUtility class will have at least three public methods: • isValidPassword: This method will check the validity of one password and return true if the password is valid and throw one or more exceptions if invalid. • isWeakPassword: This method will che throw an exception. • getInvalidPasswords This method will check an ArrayList of passwords and return an ArrayList with the status of any invalid passwords (weak passwords are not considered invalid). The ArrayList of invalid passwords will be of the following format: • For each password requirement, you must have a static private method that validates the password for that requirement and throws an exception if invalid. 3. Create a separate exception classes for each exception listed in PasswordCheckerUtility Javadoc. Hints: • Always check for the length of the password first, since that is the easiest and fastest check. Once the password fails one rule, you do not need to check the rest of the rules. • To check for a special symbol, use the “regular expression” construct. Check the whole password, not just an individual character, using the following: Pattern pattern = Pattern.compile(“[a-zA-Z0-9]*”); Matcher matcher = pattern.matcher(str); return (!matcher.matches()); • You will need to import Pattern and Matcher. • Few helpful links on regular expression” • https://www.vogella.com/tutorials/JavaRegularExpressions/article.html • https://www.youtube.com/watch?v=rhzKDrUiJVk • https://www.youtube.com/watch?v=sCuOJ8uadOgThe GUI: The GUI has been provided, however you need to: • Ask the user to enter the password and to re-type the password. If the two are not the same, inform the user. • Use methods of PasswordCheckerUtility to check validity of one password when user clicks on “Check Password” button. • Use methods of PasswordCheckerUtility to check validity of a file of passwords when user clicks on “Check Passwords in File” button. • Use a FileChooser for the user to select the input file. • Use try/catch structure to catch exceptions thrown by PasswordCheckerUtility methodsExceptions Provide exception classes for the following: 1. Length of password is less than 6 characters (class LengthException) Message – The password must be at least 6 characters long 2. Password doesn’t contain an uppercase alpha character (class NoUpperAlphaException) Message – The password must contain at least one uppercase alphabetic character 3. Password doesn’t contain a lowercase alpha character (class NoLowerAlphaException) Message – The password must contain at least one lowercase alphabetic character 4. Password doesn’t contain a numeric character (class NoDigitException) Message – The password must contain at least one digit 5. Password doesn’t contain a special character (class NoSpecialCharacterException) Message – The password must contain at least one special character 6. Password contains more than 2 of the same character in sequence (class InvalidSequenceException) Message – The password cannot contain more than two of the same character in sequence. 7. Password contains 6 to 9 characters which are otherwise valid (class WeakPasswordException) Message – The password is OK but weak – it contains fewer than 10 characters. 8. For GUI – check if Password and re-typed Password are identical (class UnmatchedException) Message – The passwords do not match Throw this exception from the GUI, not the utility class.Note: If more than one error is present in a password, use the above order to throw exceptions. For example, if a password is “xxyyzzwwaa$”, it fails rules 2 and 4 above. Throw a NoUpperAlphaException, not a NoDigitException.Junit methods: • setup • teardown • for each password requirement method in the PasswordCheckerUtitily you must have a test case that passes and another one that fails • success and fail test cases for each public method in the PasswordCheckerUtitily • The file that you use for getInvalidPasswords method Junit test must contain at least one invalid and one valid of each password requirement case.This is a sample of Junit test cases that you must have:If you select the button which reads “Check Passwords in File”, you will be presented with a file chooser. You must navigate to where you stored the file “passwords.txt” and load it. The file will be in the following format (one password per line):Examples:1. No lowercase alphabetic characterDisplayed to user:2. No digitDisplayed to user:3. If the password is OK, but between 6 and 10 characters, you will see:If password has more than two of the same characters in a rowDisplayed to user:If password is validIf the passwords do not match:Displayed to user:6. Based on the file above, when the user selects “Check Passwords in File”:Displays errors to user when selecting Check Passwords in File. Note that valid passwords (including weak but otherwise valid passwords) are NOT displayed.Deliverables:Design: Initial design document (UML and/or pseudo-code)Implementation: Final design document Java files – The src folder with your driver (javafx application), data manager, exceptions and Junit Test (.java) files Javadoc files – The entire doc folder with your javadoc for student generated files Learning Experience document GitHub screen shotDeliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats: LastNameFirstName_AssignmentX.zip [compressed file containing following]: doc [a directory] include the entire doc folder with the javadoc for student generated files file1.html (example) file2.html (example) class-use (example directory) LearningExperience.doc or other text format src [a directory] contains your driver (javafx application), data manager, exceptions and Junit Test (.java) files File1.java (example) File2.java (example) File_Test.java (example) GitHub screen shot. LastNameFirstName_AssignmentX_Moss.zip [compressed file containing only]: .java file which includes the driver (javafx application), data manager, exceptions and Junit Test (.java) files – NO FOLDERS!! File1.java (example) File2.java (example)Grading Rubric CMSC 204 Project #1 Name _____________________________Overview: There are two parts to the rubric. First, the project is graded on whether it passes public and private tests. If it does not compile, a 0 will be given. These points add up to 100. Second, the score is decremented if various requirements are not met, e.g., missing required methods, missing Junit test cases, no Javadoc, no UML diagram, uses constructs that are not allowed, etc.TESTING (100 pts) Compiles 35 pts _____ Student Junit required student tests 8 pts _____ Passes JUnit student tests 7 pts _____ Passes public JUnit tests 15 pts _____ Execution: runs without errors (either run-time or logic errors 20 pts _____ Possible Sub-total 100 pts _____REQUIREMENTS (Subtracts from Testing total)Documentation: Javadoc for student generated files not submitted (entire doc folder) -5 pts _____ Documentation within source code was missing or incorrect -1.5 pts _____ Description of what class does was missing Author’s Name, @author, was missing Methods not commented properly using Javadoc @param, @return JUnit STUDENT methods were not implemented -10 pts _____ Screen shot of GitHub repo with Assignment1 files was not submitted -5 pts _____ MOSS files were not submitted -5 pts _____ Learning Experience -2.5 pts _____ In 3+ paragraphs, highlight your lessons learned and learning experience from working on this project. What have you learned? What did you struggle with? What would you do differently on your next project?Programming Style: Incorrect use of indentation, statements, structures -2 pts _____Design: Implementation does not follow final design -4 pts _____Classes do not have the functionality specified, i.e., 1. PasswordCheckerUtility class -10 pts _____ does not have a method to check validity of password does not have a method to check validity of ArrayList of passwords does not follow the Javadoc provided does not have private method for each password requirement 2. GUI does not compile -5 pts _____ 3. Exceptions classes -10 pts _____ does not have exception class for each invalid password rule does not have exception class for weak password does not have exception class if password and re-type password don’t match does not have exception class for each password requirement Possible decrements: -60 pts _____ Possible total grade: 100 pts _____

$25.00 View

[SOLVED] Cmsc203 –

A property management company manages individual properties they will build to rent, and charges them a management fee as the percentages of the monthly rental amount. The properties cannot overlap each other, and each property must be within the limits of the management company’s plot. Write an application that lets the user create a management company and add the properties managed by the company to its list. Assume the maximum number of properties handled by the company is 5.• Aggregation • Passing object to method • Array Structure • Objects as elements of the Array • Processing array elements • Copy Constructor • Junit testingData Element class – Property.java The class Property will contain: 1. Instance variables for property name, city, rental amount, owner, and plot. Refer to JavaDoc for the data types of each instance variable. 2. toString method to represent a Property object. 3. Constructors and getter and setter methods. Refer to Javadoc of the Property class.Data Element class – Plot.java The class Plot will contain: 1. Instance variables to represent the x and y coordinates of the upper left corner of the location, and depth and width to represent the vertical and horizontal extents of the plot. 2. A toString method to represent a Plot object 3. Constructors, Refer to Javadoc for Plot class. 4. A method named overlaps that takes a Plot instance and determines if it is overlapped by the current plot. 5. A method named encompasses that takes a Plot instance and determines if the current plot contains it. Note that the determination should be inclusive, in other words, if an edge lies on the edge of the current plot, this is acceptable. Data Structure – An Array of Property objects to hold the properties that the management company handles. This array will be declared as an attribute of the ManagementCompany class.Data Manager class – ManagementCompany.java It will contain instance variables of name, tax Id, management fee, MAX_PROPERTY (a constant set to 5) and an array named properties of Property objects of size MAX_PROPERTY, as well as two constants MGMT_WIDTH and MGMT_DEPTH, both set to 10; an attribute plot of type Plot that defines the plot of the ManagementCompany Class. Refer to Javadoc for more details. The class ManagementCompany will contain the following methods in addition to get and set methods: 1. Constructors (refer to Javadoc for more details) 2. Method addProperty (3 versions): 2.1.1. Pass in a parameter of type Property object (calls Property copy constructor). It will add the copy of the Property object to the properties array. 2.2. Method addProperty version 2: 2.2.1. Pass in four parameters of types: • String propertyName, • String city, • double rent, • String ownerName. 2.2.2. Calls Property 4-arg constructor. 2.3. Method addProperty version 3: 2.3.1. Pass in eight parameters of types: • String propertyName, • String city, • double rent, • String ownerName, • int x, • int y, • int width • int depth. 2.3.2. Calls Property 8-arg constructor. 2.4. addProperty methods will return the index of the array where the property is added. If there is a problem adding the property, this method will return -1 if the array is full, -2 if the property is null, -3 if the plot for the property is not encompassed by the management company plot, or -4 if the plot for the property overlaps any other property’s plot. 3. Method totalRent– Returns the total rent of the properties in the properties array.4. Method maxRentPropertyIndex- returns the index of the property within the properties array that has the highest rent amount. This method will be private. 5. Method maxRentProp- Returns the highest rent amount of the property within the properties array. For simplicity assume that each “Property” object’s rent amount is different. This method should call the maxRentPropertyIndex method. 6. Method toString- returns information of ALL the properties within this management company by accessing the “Properties” array. The format is as following example:List of the properties for Alliance, taxID: 1235 ______________________________________________________ Property Name : Belmar Located in Silver Spring Belonging to:John Smith Rent Amount: 1200.0 Property Name : Camden Lakeway Located in Rockville Belonging to:Ann Taylor Rent Amount: 2450.0 Property Name : Hamptons Located in Rockville Belonging to:Rick Steves Rent Amount: 1250.0 ______________________________________________________total management Fee: 294.0Driver class – (provided) The provided PropertyMgmDriverNoGui.java is a class that allows you to test the methods of ManagementCompany.javaGUI Driver class – (provided) A Graphical User Interface (GUI) is provided. Be sure that the GUI will compile and run with your methods. The GUI will not compile if your methods in ManagementCompany.java are not exactly in the format specified. Do not modify the GUI.JUnit Test Run the JUnit test file (provided). Ensure that the JUnit tests all succeed. Do not modify the JUnit tests. Implement your tests in ManagementCompanyTestSTUDENT. These tests should be similar to the Junit tests.Write a Data Element Class named Property that has fields to hold the property name, the city where the property is located, the rent amount, the owner’s name, and the Plot to be occupied by the property, along with getters and setters to access and set these fields. Write a parameterized constructor (i.e., takes values for the fields as parameters) and a copy constructor (takes a Property object as the parameter). Follow the Javadoc file provided.A driver class is provided that creates rental properties to test the property manager. A Graphical User Interface is provided using JavaFX which duplicates this driver’s functionality. You are not required to read in any data, but the GUI will allow you to enter the property management company and each property by hand. A directory of images is provided. Be sure to place the “images” directory (provided) inside the “src” directory in Eclipse. The images do not need to display in order for the GUI to continue running.Upload the initial files from Blackboard and your final java files to GitHub in your repo from Lab 1, in a directory named CMSC203_Assignment4.Operation When driver-driven application starts, a driver class (provided) creates a management company, creates rental properties, adds them to the property manager, and prints information about the properties using the property manager’s methods. When the GUI-driven application starts (provided), a window is created as in the following screen shots which allows the user to enter applicable data and display the resulting property. The driver and the GUI will both use the same classes and methods for their operation. The JUnit test class also tests the same classes as the driver and the GUI. Expected output from running PropertyMgmDriverNoGui.javaExpected output from running with GUI:PropertyMgmGui.java at startupAdd Management Co Info (Note Mgmt Co Plot)Add property information – the Plot outlineAdd property information – successful additionAdd property information – unsuccessful: overlapsAdd property information – unsuccessful: Mgmt Co Plot does not encompass Property Plot Note: red rectangle’s width extends to right of window.Add property information – unsuccessful: too many propertiesResult of “Max Rent” button Result of “Total Rent” buttonResult of “List of Properties” button• Turn in a UML class diagram in a Word document. • Submit pseudo-code for the primary methods specified in ManagementCompany.java, Property.java, and Plot.java in a Word document. Do not just list what gets read in a printed out, but explain the algorithm being used. • Learning Experience: highlight your lessons learned and learning experience from working on this project. o What have you learned? o What did you struggle with? o What will you do differently on your next project? o Include what parts of the project you were successful at, and what parts (if any) you were not successful at. • GitHub: In your repository (see Lab 1), upload your Word file and java file. You will want to upload these files as contents of a directory so that future uploads can be kept separate. Take and submit a screen shot of the GitHub repository. Notes: • Proper naming conventions: All constants, except 0 and 1, should be named. Constant names should be all upper-case, variable names should begin in lower case, but subsequent words should be in title case. Variable and method names should be descriptive of the role of the variable or method. Single letter names should be avoided. Indentation: It must be consistent throughout the program and must reflect the control structureSubmission Detail Submit the following files: • Word document with a name FirstInitialLastName_Assignment3.docx should include: o UML Class Diagram o Pseudocode for each of the methods specified in ManagementCompany.java, Property.java, and Plot.java. o Screen snapshots of the GUI with several properties o Screen snapshot of GitHub submission o Lessons Learned o Check List o doc (a directory) containing your javadoc files o src (a directory) contains your (.java) files o File1.java (example) ▪ File2.java (example) ▪ File_Test.java (example)• A zip file will only contain the .java files and will be named: FirstInitialLastName_Assignment4_Moss.zip. This .zip will not have any folders in it – only .java files.Grading Rubric See attachment: CMSC203 Assignment 4 Rubric_Summer20.xlsxAssignment 4 Check List # Y/N Comments 1. Assignment files: • FirstInitialLastName_ Assignment#_Moss.zip • FirstInitialLastName_Assignment#.docx/.pdf • Source java files 2. Program compiles 3. Program runs with desired outputs related to a Test Plan 4. Documentation file: • Comprehensive Test Plan • Screenshots for each Test case listed in the Test Plan • Screenshots of your GitHub account with submitted Assignment# (if required) • UML Diagram • Algorithms/Pseudocode • Flowchart (if required) • Lessons Learned • Checklist is completed and included in the Documentation

$25.00 View

[SOLVED] Cmsc203 –

Write a Java program to encrypt and decrypt a phrase using two similar approaches, each insecure by modern standards.The first approach is called the Caesar Cipher, and is a simple “substitution cipher” where characters in a message are replaced by a substitute character.• Using loops • String and character processing • ASCII codesData Manager class – CryptoManager.java • Implement each of the methods specified in this file. This version as provided will print error messages in the console, because they are just the skeletons. • Each of the methods are static, so there is no need to create an instance of the Data Manager. • Document each of your methods with a simple description and document the class with a simple description and your name using in-line comments (//…). (Just a short sentence fragment will suffice for each documentation string.) • The methods are described below. • public static boolean stringInBounds (String plainText); This method determines if a string is within the allowable bounds of ASCII codes according to the LOWER_BOUND and UPPER_BOUND characters. The parameter plainText is the string to be encrypted. The method returns true if all characters are within the allowable bounds, false if any character is outside. • public static String encryptCaesar(String plainText, int key); This method encrypts a string according to the Caesar Cipher. The integer key specifies an offset and each character in plainText is replaced by the character the specified distance away from it. The parameter plainText is an uppercase string to be encrypted. The parameter key is an integer that specifies the offset of each character. The method returns the encrypted string. • public static String decryptCaesar(String encryptedText, int key); This method decrypts a string according to the Caesar Cipher. The integer key specifies an offset and each character in encryptedText is replaced by the character “offset” characters before it. This is the inverse of the encryptCaesar method. The parameter encryptedText is the encrypted string to be decrypted, and key is the integer used to encrypt the original text. The method returns the original plain text string. • public static String encryptBellaso(String plainText, String bellasoStr); This method encrypts a string according to the Bellaso Cipher. Each character in plainText is offset according to the ASCII value of the corresponding character in bellasoStr, which is repeated to correspond to the length of plaintext. The method returns the encrypted string. • public static String decryptBellaso(String encryptedText, String bellasoStr); This method decrypts a string according to the Bellaso Cipher. Each character in encryptedText is replaced by the character corresponding to the character in bellasoStr, which is repeated to correspond to the length of plainText. This is the inverse of the encryptBellaso method. The parameter encryptedText is the encrypted string to be decrypted, and bellasoStr is the string used to encrypt the original text. The method returns the original plain text string. • Add additional methods if you wish to make your logic easier to follow.GUI Driver class – (provided) • A Graphical User Interface (GUI) is provided. Be sure that the GUI will compile and run with your methods. The GUI will not compile if your method headers in CryptoManager.java are not exactly in the format specified. When you first run the application, your methods will all throw exceptions, which will be caught by the GUI and printed out in the console. • Do not modify the GUI. • The GUI takes care of capitalizing your input strings.JUnit Test/Test Driver • Once your methods are implemented, run the test driver. Ensure that the driver file results in the following output, as shown in RED (of course the output will not be in red when you run the test driver): “THIS TEST SHOULD SUCCEED” Is it in bounds? true “THIS TEST THAT SHOULD FAIL BECAUSE { IS OUTSIDE THE RANGE” Is it in bounds? false “This test should fail because of lowercase letters” Is it in bounds? false Caesar cipher of “THIS IS ANOTHER TEST” should return “WKLV#LV#DQRWKHU#WHVW”: WKLV#LV#DQRWKHU#WHVW Bellaso cipher of “THIS IS ANOTHER TEST” should return “WUVR9F#N!RF88U-‘HED”: WUVR9F#N!RF88U-‘HED Caesar decryption of “WKLV#LV#DQRWKHU#WHVW” should return “THIS IS ANOTHER TEST”: THIS IS ANOTHER TEST Bellaso decryption of “WUVR9F#N!RF88U-‘HED” should return “THIS IS ANOTHER TEST”: THIS IS ANOTHER TEST • Run the JUnit test file (provided). Ensure that the JUnit tests all succeed. • Include CryptoTest.java and CryptoManagerTest.java with the rest of your submission.The first approach is called the Caesar Cipher, and is a simple “substitution cipher” where characters in a message are replaced by a substitute character. The substitution is done according to an integer key which specifies the offset of the substituting characters. For example, the string ABC with a key of 3 would be replaced by DEF. If the key is greater than the range of characters we want to consider, we “wrap around” by subtracting the range from the key until the key is within the desired range. For example, if we have a range from space (‘ ‘) to ‘_’ (i.e., ASCII 32 to ASCII 95), and the key is 120, we note that 120 is outside the range. So we subtract 95-32+1=64 from 120, giving 56, which in ASCII is the character ‘8’. If the key is even higher, we can subtract the range from the key over and over until the key is within the desired range. Since our specified range does not include lower-case letters, the GUI (provided) will change strings to upper case. You can find the ASCII table at http://www.asciitable.com/, or many other places on the Internet. So for the string ABCDEFG and the key word CMSC, the key word is first extended to the length of the string, i.e., CMSCCMS. Then A is replaced by ‘A’ offset by ’C’, i.e., ASCII 65+67=132. The range of the characters is also specified, and again we’ll say ‘ ‘ to ‘_’ (i.e., ASCII 32 to ASCII 95). The range is then 95-32+1=64. In our example, the offset is “wrapped” by reducing 132 by the range until it is the allowable range. 132 is adjusted to 132-64=68, or character ‘D’ in the encrypted phase. Then the same logic is applied to the second letter of the plain text ‘B’ shifted by the second letter of the key word ‘M’. This results in the character ‘O’ as the second letter in the encrypted phase, and so on. In each approach, if the resulting integer is greater than 95 (the top of our range), the integer is “wrapped around” so that it stays within the specified range. The result is “DOVGHSZ”. Your program will implement several methods that are specified in the file “CryptoManager.java”. A Graphical User Interface is provided, as well as a test file, that you should use to make sure your methods work correctly. Be sure to follow the naming exactly, as the tests will not work otherwise.• Turn in pseudo-code for each of the methods specified in CryptoManager.java. Your pseudo-code should be part-way between English and java. There is no need to spell out all the details of variable declaration, etc., but by the same token, the pseudo-code needs to have enough detail that a competent Java programmer could implement it. • Turn in a test table with o at least two tests for the Caesar Cipher o at least two tests for the Bellaso Cipher o at least one string that will fail because it has characters outside the acceptable ones. • Learning Experience: highlight your lessons learned and learning experience from working on this project. o What have you learned? o What did you struggle with? o What will you do differently on your next project? o Include what parts of the project you were successful at, and what parts (if any) you were not successful at. • GitHub: In your repository (see Lab 1), upload the files initially provided in Blackboard for the project. When you are finished with the design and programming, upload your Word file and java file. You will want to upload these files as contents of a directory so that future uploads can be kept separate. Take and submit a screen shot of the GitHub repository. Notes: • Proper naming conventions: All constants, except 0 and 1, should be named. Constant names should be all upper-case, variable names should begin in lower case, but subsequent words should be in title case. Variable and method names should be descriptive of the role of the variable or method. Single letter names should be avoided. Indentation: It must be consistent throughout the program and must reflect the control structureSubmission Detail Submit the following files: • Word document with a name FirstInitialLastName_Assignment3.docx should include: o Pseudocode for each of the methods specified in CryptoManager.java. o Test Plan o Screen snapshots of outputs from Eclipse based on your Test Plan o Screen snapshot of GitHub submission o Lessons Learned o Check List• A zip file will only contain the .java files and will be named: FirstInitialLastName_Assignment3_Moss.zip. This .zip will not have any folders in it – only .java files. Here’s an example for Assignment 3: R_Brown_Assignment2.docx R_Brown_Assignment2_Moss.zip [a compressed file containing only the following]CryptoManager.java CryptoTest.java CryptoManagerTest.javaTest your program with at least 3 test cases. Make sure your tests cover all the possible scenarios.Input text Input Key Encrypted (method1) Encrypted (method2) Decrypt (method1) Decrypt (method2)Grading Rubric See attachment: CMSC203 Assignment 3 Rubric_Summer20.xlsxAssignment 3 Check List # Y/N Comments 1. Assignment files: • FirstInitialLastName_ Assignment#_Moss.zip • FirstInitialLastName_Assignment#.docx/.pdf • Source java files 2. Program compiles 3. Program runs with desired outputs related to a Test Plan 4. Documentation file: • Comprehensive Test Plan • Screenshots for each Test case listed in the Test Plan • Screenshots of your GitHub account with submitted Assignment# (if required) • UML Diagram (if required) • Algorithms/Pseudocode (if required) • Flowchart (if required) • Lessons Learned • Checklist is completed and included in the Documentation

$25.00 View

[SOLVED] Cmsc 430 project 4

The fourth project involves modifying the semantic analyzer for the attached compiler by adding checks for semantic errors. The static semantic rules of this language are the following: Variables and parameter names have local scope. The scope rules require that all names be declared and prohibit duplicate names within the same scope. The type correspondence rules are as follows: • Boolean expressions cannot be used with arithmetic or relational operators. • Arithmetic expressions cannot be used with logical operators. • Reductions can only contain numeric types. • Only integer operands can be used with the remainder operator. • The two statements in an if statement must match in type. No coercion is performed. • All the statements in a case statement must match in type. No coercion is performed. • The type of the if expression must be Boolean. • The type of the case expression must be Integer • A narrowing variable initialization or function return occurs when a real value is being forced into integer. Widening is permitted. • Boolean types cannot be mixed with numeric types in variable initializations or function returns. Type coercion from an integer to a real type is performed within arithmetic expressions. You must make the following semantic checks. Those highlighted in yellow are already performed by the code that you have been provided, although you are must make minor modifications to account for the addition of real types and the need to perform type coercion and to handle the additional arithmetic and logical operators. • Using Boolean Expressions with Arithmetic Operator • Using Boolean Expressions with Relational Operator • Using Arithmetic Expressions with Logical Operator • Reductions containing nonnumeric types • Remainder Operator Requires Integer Operands • If-Then Type Mismatch • Case Types Mismatch • If Condition Not Boolean • Case Expression Not Integer • Narrowing Variable Initialization • Variable Initialization Mismatch • Undeclared Variable • Duplicate Variable • Narrowing Function Return This project requires modification to the bison input file, so that it defines the additional semantic checks necessary to produce these errors and addition of functions to the library of type checking functions already provided in types.cc. You must also make some modifications to the functions provided. You need to add a check to the checkAssignment function for mismatched types in the case that Boolean and numeric types are mixed. You need to also add code to the checkArithmetic function to coerce integers to reals when the types are mixed and the error message must be modified to indicate that numeric rather than only integer types are permitted. The provided code includes a template class Symbols that defines the symbol table. It already includes a check for undeclared identifiers. You need to add a check for duplicate identifiers. Like the lexical and syntax errors, the compiler should display the semantic errors in the compilation listing, after the line in which they occur. An example of compilation listing output containing semantic errors is shown below: 1 — Test of Multiple Semantic Errors 2 3 function test a: integer returns integer; 4 b: integer is 5 if a + 5 then 6 2; 7 else 8 5; 9 endif; Semantic Error, If Expression Must Be Boolean 10 c: real is 9.8 – 2 + 8; 11 d: boolean is 7 = f; Semantic Error, Undeclared f 12 begin 13 case b is 14 when 1 => 4.5 + c; 15 when 2 => b; Semantic Error, Case Types Mismatch 16 others => c; 17 endcase; 18 end;Lexical Errors 0 Syntax Errors 0 Semantic Errors 3You are to submit two files. 1. The first is a .zip file that contains all the source code for the project. The .zip file should contain the flex input file, which should be a .l file, the bison file, which should be a .y file, all .cc and .h files and a makefile that builds the project. 2. The second is a Word document (PDF or RTF is also acceptable) that contains the documentation for the project, which should include the following: a. A discussion of how you approached the project b. A test plan that includes test cases that you have created indicating what aspects of the program each one is testing and a screen shot of your compiler run on that test case c. A discussion of lessons learned from the project and any improvements that could be made Grading Rubric Criteria Meets Does Not Meet Functionality 70 points 0 pointsGenerates semantic error when a remainder operator has non-integer operands (10) Does not generate semantic error when a remainder operator has noninteger operands (0) Generates semantic error when if and then types don’t match (10) Does not generate semantic error when if and then types don’t match (0) Generates semantic error when case types don’t match (10) Does not generate semantic error when case types don’t match (0) Generates semantic error when if condition is not Boolean (10) Does not generates semantic error when if condition is not Boolean (0) Generates semantic error when case expression is not integer (10) Does not generate semantic error when case expression is not integer (0) Generates semantic error on narrowing initialization (10) Does not generate semantic error on narrowing initialization (0) Generates semantic error for duplicate variables (10) Does not generate semantic error for duplicate variables (0) Test Cases 15 points 0 pointsIncludes test cases that test all type checking errors (10) Does not Include test cases that test all type checking errors (0) Includes test cases that test all symbol table errors (3) Does not include test cases that test all symbol table errors (0) Includes test case with multiple errors (2) Does not include test case with multiple errors (0) Documentation 15 points 0 pointsDiscussion of approach included (5) Discussion of approach not included (0) Lessons learned included (5) Lessons learned not included (0)

$25.00 View

[SOLVED] Cmsc203 –

Concepts tested by this assignment• Input validation loops • Relational and logical operators • Use a worker class • Create a driver class • Currency format • Random number generation • GitHubCreate a driver class called Birthday. This class will use the Toy class provided for you. Refer to Assignment Details for implementing the Birthday class. You should not make any changes to the Toy class.• All input items and messages will use Dialog boxes. Only the title, list of gifts, total, order number, and programmer name will be printed on the console. NOTE: if you use a Mac, you must use Alerts and TextInputDialog; if you use a Windows machine, JOptionPane (See Chapter 2, Topic 2.14 Dialog Boxes) is slightly simpler, or you could use the Alerts/TextInputDialog option. (See Lecture_ 5_2 Using Library Classes) • Use a Dialog box to display the welcome message. • Ask for the name of the child. • Ask for the age of the child. • Ask for the toy choice and validate the input choice. • Print out a message if the toy is not age appropriate and ask if the user wants to cancel that toy request. • If the user replies “yes”, repeat the steps for the name, age, and toy choice. If the user replies “no”, process the toy requested. • Ask if a card or balloon should be added to the gift. • Display on the console the name, age and the total for gift. • Ask if another gift is desired. If yes, repeat the steps starting with the name of the child. • If no, display on the console the total amount of the order, a random five-digit order number, and the programmer name. • All costs displayed on the console should use currency format. • Write about your Learning Experience, highlighting your lessons learned and learning experience from working on this project. What have you learned? What did you struggle with? What would you do differently on your next project? What parts of this assignment were you successful with, and what parts (if any) were you not successful with. • GitHub: In your repository (see Lab 1), upload your design Word file and java files. You will want to upload these files as contents of a directory so that future uploads can be kept separate.Sample console output:BIRTHDAY GIFTSThe gift for Susie Smith 2 years old is plushie $25.00 The gift for Johnny Jones 5 years old is blocks $20.00 The total cost of your order is $45.00 Order number is 19578 Programmer: insert your name hereTo satisfy the “Good Faith Attempt” (see Blackboard) your code must compile and print the output without finding the name, age, type of toy, cost, or order number. Your GFA need not show the prompts, create the Toy object, or compute the cost or order number. The output for the GFA will be: The gift for x 0 years old is blocks $0.00 The total cost of your order is $0.00 Order number is 0 Programmer: insert your name hereTest your program with at least 3 test cases. Make sure your tests cover all the possible scenarios. Test Case # Input Expected Output Actual OutputDid the test pass?12 3DeliverablesImplementation: • Turn in your Design: pseudo-code and test cases • Turn in the working java file Birthday.java (not the .class file). • Learning Experience: highlight your lessons learned and learning experience from working on this project. What have you learned? What did you struggle with? What will you do differently on your next project? Include what parts of the project you were successful at, and what parts (if any) you were not successful at. • GitHub: In your repository (see Lab 1), upload the files initially provided in Blackboard for the project. When you are finished with the design and programming, upload your design file and java file. You will want to upload these files as contents of a directory so that future uploads can be kept separate. Take a screen shot of the GitHub repository.Submission Detail Submit the following files: • Word document with a name FirstInitialLastName_Assignment2.docx should include: o Pseudocode o Test Plan o Screen snapshots of outputs from Eclipse (related your Test Plan) o Screen snapshots of outputs from CmdLine o Screen snapshot of GitHub submission o Lessons Learned o Check List• A zip file will only contain the .java files and will be named: FirstInitialLastName_Assignment2_Moss.zip. This .zip will not have any folders in it – only .java files. Here’s an example for Assignment 2: R_Brown_Assignment2.docx R_Brown_Assignment2_Moss.zip [a compressed file containing only the following] Birthday.java

$25.00 View

[SOLVED] Cmsc 430 project 3

The third project involves modifying the attached interpreter so that it interprets programs for the complete language. When the program is run on the command line, the parameters to the function should be supplied as command line arguments. For example, for the following function header of a program in the file text.txt: function main a: integer, b: integer returns integer; One would execute the program as follows: $ ./compile < test.txt 2 4 In this case, the parameter a would be initialized to 2 and the parameter b to 4. An example of a program execution is shown below: $ ./compile < test.txt 2 41 function main a: integer, b: integer returns integer; 2 c: integer is 3 if a > b then 4 a rem b; 5 else 6 a ** 2; 7 endif; 8 begin 9 case a is 10 when 1 => c; 11 when 2 => (a + b / 2 – 4) * 3; 12 others => 4; 13 endcase; 14 end;Compiled SuccessfullyResult = 0 After the compilation listing is output, the value of the expression which comprises the body of the function should be displayed as shown above. The existing code evaluates some of the arithmetic, relational and logical operators together with the reduction statement and integer literals only. You are to add the necessary code to include all of the following: • Real and Boolean literals • All additional arithmetic operators • All additional relational and logical operators • Both if and case statements • Functions with multiple variables • Functions with parameters This project requires modification to the bison input file, so that it defines the additional the necessary computations for the above added features. You will need to add functions to the library of evaluation functions already provided in values.cc. You must also make some modifications to the functions already provided. You are to submit two files. 1. The first is a .zip file that contains all the source code for the project. The .zip file should contain the flex input file, which should be a .l file, the bison file, which should be a .y file, all .cc and .h files and a makefile that builds the project. 2. The second is a Word document (PDF or RTF is also acceptable) that contains the documentation for the project, which should include the following: a. A discussion of how you approached the project b. A test plan that includes test cases that you have created indicating what aspects of the program each one is testing and a screen shot of your compiler run on that test case c. A discussion of lessons learned from the project and any improvements that could be made Grading Rubric Criteria Meets Does Not Meet Functionality 70 points 0 pointsFunctions with real and Boolean literals evaluated correctly (5) Functions with real and Boolean literals not evaluated correctly (0) Subtraction and division operators evaluated correctly (5) Subtraction and division operators not evaluated correctly (0) Remainder operator evaluated correctly (5) Remainder operator not evaluated correctly (0) Exponentiation operator evaluated correctly (5) Exponentiation operator not evaluated correctly (0) Additional relational operators evaluated correctly (5) Additional relational operators not evaluated correctly (0) Additional logical operators evaluated correctly (5) Additional logical operators not evaluated correctly (0) if conditional expressions evaluated correctly (10) if conditional expressions not evaluated correctly (0) case conditional expressions evaluated correctly (10) case conditional expressions not evaluated correctly (0) Functions with multiple variables evaluated correctly (10) Functions with multiple variables not evaluated correctly (0) Functions with parameters evaluated correctly (10) Functions with parameters not evaluated correctly (0) Test Cases 15 points 0 pointsIncludes test cases that test real and Boolean literals (3) Does not Include test cases that test real and Boolean literals (3) Includes test cases that test all arithmetic operators (3) Does not include test cases that test all arithmetic operators (0) Includes test cases that test all relational and logical operators (3) Does not include test cases that test all relational and logical operators (0) Includes test cases that test both conditional expressions (3) Does not include test cases that test both conditional expressions (0) Includes test cases with variables and parameters (3) Does not include test cases with variables and parameters (0) Documentation 15 points 0 pointsDiscussion of approach included (5) Discussion of approach not included (0) Lessons learned included (5) Lessons learned not included (0)

$25.00 View