Assignment Chef icon Assignment Chef

Browse assignments

Assignment catalog

33,401 assignments available

[SOLVED] Csci 4230 – assignment 4

For this assignment you must write the following functions in Scheme: 1. Write a function called letterGrade that takes a number between 0 and 100 and returns a string containing the corresponding letter grade where 90 and above is an A, 80-89 is a B, and so on. Use a cond expression to implement this. If the number is out of range, return the string “Error: out of range”.2. Write a function called countdown that takes a positive integer and uses a do expression to display a sequence of numbers counting down to 1, each on its own line, then displaying the string “Blastoff!”. 3. Write a recursive function called eval-poly that takes a list of numbers representing the coefficients of a polynomial and a value for x and evaluates the polynomial for the given value of x. The list of coefficients should start with the term of lowest degree and end with the term of highest degree. If any term of intermediate degree is missing from the polynomial it should have a coefficient of zero. For example, the polynomial x 3 + 4x 2 + 2 would be represented by the list ’(2 0 4 1). Hint: the polynomial above can be rewritten as 2 + x · (0 + x · (4 + x · 1))4. Write a tail-recursive version of the previous problem called eval-poly-tail. It should call a helper function called eval-poly-tail-helper that uses tail recursion to keep a running sum of the terms evaluated so far. You might want to use the expt function to take a number to a power. 5. Write a recursive function called split that takes a list and returns a list containing two lists, each of which has roughly half the items in the original list. The easiest way to do this is to alternate items between the two lists, so that (split ’(1 2 3 4 5)) would return ’((1 3 5) (2 4)). I recommend using two base cases: one for an empty list and the other for a list containing one item. 6. Write a recursive function called merge that takes two sorted lists of numbers and merges them together into one sorted list containing all of the number in both lists including duplicates.7. Write a recursive function called mergesort that sorts a list by doing the following: (a) Use split to split the list into two roughly equal-sized partitions. (b) Recursively sort both partitions. (c) Use merge to merge the sorted partitions together. Once again you will need two base cases, one for the empty list and the other for a single-element list.What to Hand In Implement all of the functions described above in a source file called yourlastnameAssign4.scm with your actual last name. Make sure to put your name, CSCI 4230, and Assignment 4 in the comments (comments in Scheme start with ;;). Upload the source file to D2L to the dropbox called Assignment 4.

$25.00 View

[SOLVED] Csci 4230 – assignment 1

1. Write regular expressions for the following. The alphabet in question consists of a, b, and c. (a) Strings that start with a followed by zero or more occurrences of b. (b) Strings that start with a followed by zero or more occurrences of either b or c. (c) Strings that start with a followed by one or more occurrences of b. (d) Strings that have an even number of characters. (e) Strings that have an odd number of characters.2. Write a regular expression for a string literal defined as follows: • Starts with a “. • Ends with a “. • Between these two characters a string literal may contain any number of characters that are not a ” or a . You can represent such a character with the symbol normal_char, which you do not have to define separately. • In addition a string literal can contain any of the following escape codes: , ”, and \. • Examples include “”, “Hello”, and “Hello, World! ”.3. Write a regular expression for an identifier defined as follows: • Must start with a letter or a _. • After the first character, there may be any number of digits, letters, or underscores. • Use [0-9] to represent a single digit and [a-zA-Z] to represent a single letter. • Examples include x, MyVar, my_var, and my_var3.4. Write a regular expression for a floating point number defined as follows: • A sequence of digits followed by a . followed by a sequence of digits. • The sequence before the . may be empty and can only start with 0 if it is the only digit in the sequence. • The sequence after the . must contain at least one digit. • Examples include 0.5, 3.141592, 256.0, and .142857.

$25.00 View

[SOLVED] Csci 4100 – assignment 7 – virtual memory

Implement a simulated virtual address space. Required Reading PoCSD 5.3-5.4, 6.2For this assignment you will be writing a simulated virtual address space. The system you are simulating has the following attributes: • Both virtual addresses and physical addresses are 16 bits or 2 bytes long. • The page size is 256 (28 ) bytes, so a virtual address consists of an 8-bit page number and an 8-bit offset and a physical address consists of an 8-bit frame number and an 8-bit offset. • Since a page number is 8 bits long, there must be 28 or 256 page table entries. • Each page table entry is 16 bits long and contains several additional bits along with the frame number for the associated page.Data Types Working with page tables is largely a matter of manipulating bits. I have introduced several data types based on unsigned integers that make it a little clearer what all of these bits mean: • page_table – An array of 256 page table entries. Use this data type to create your page table: page_table table ; • pt_address – A 16-bit virtual or physical address. • pt_index – An 8-bit page or frame number. • pt_offset – An 8-bit offset within a page. • pt_entry – A 16-bit page table entry. Use this data type when you are looking up an entry in a page table: pt_entry entry = table [ page_num ];• pt_bits – Eight bits that provide the following information: – PT_ALLOC – the page has been allocated in the virtual address space. – PT_DIRTY – the page has been written to recently. – PT_ACCESS – the page has been read from recently. – PT_PRESENT – the page is resident in physical memory. – PT_KERNEL – the page is only accessible in kernel mode. – PT_READ – the page may be read from. – PT_WRITE – the page may be written to. – PT_EXECUTE – the page contains executable instructions. All of these data types are defined in the file va_space.h.Functions You must implement the following functions: • pt_init – initializes all of the entries in a page table to zero, which among other things marks them as unallocated. • pt_map – maps a page to a frame in a page table with the given permissions. The entry should have its allocated and present bits set, but not the accessed or dirty bits. • pt_unmap – removes an entry from the page table by setting it to zero. • pt_set_dirty, pt_set_accessed, pt_set_present – sets the corresponding bits. • pt_clear_dirty, pt_clear_accessed, pt_clear_present – clears the corresponding bits. • pt_allocated, pt_dirty, pt_accessed, pt_present – returns true if the corresponding bit is set, false otherwise.• pt_not_permitted – returns true if the accesses requested are not permitted for the page in question, false otherwise. • pt_translate – translates a virtual address to the corresponding physical address using the page table. May return one of the following errors: – ERR_PAGE_NOT_ALLOCATED – returned if the page in question has not been allocated. – ERR_PAGE_NOT_PRESENT – returned if the page is not currently resident in memory. – ERR_PERMISSION_DENIED – returned if any of the permissions requested are not allowed for that page.I have provided the following functions in the file va_space.c to help you out with debugging: • pt_display – displays the contents of the entire page table in hexadecimal notation. • pt_display_entry – displays a single page table entry in hexadecimal notation. • pt_display_address – displays a virtual or physical address in hexadecimal notation, prefaced by a string. You must also write an executable program in a file called test_va_space.c that tests all of the functions you have implemented.Hexadecimal Notation and Manipulating Bits Hexadecimal notation is particularly helpful in our system because our virtual addresses, physical addresses, and page table entries are all 16 bits long and made up of two 8-bit pieces. What this means is that they can all be represented by 4-digit hexadecimal numbers where the first two digits represent the first 8 bits and the last two digits represent the last eight bits. For example, the virtual memory address 49421 would translate to the 16-bit binary number 1100000100001101, which would be represented in hexadecimal as 0xc10d. The page number is represented by the digits c1, and the offset is represented by the digits 0d. These translate to 193 and 13 in decimal notation. If you want to isolate individual bits, you can use a mask, which is another sequence of bits where the 1’s represent the bits you want to keep and the 0’s represent the bits you dont. If we want to isolate the offset in a virtual address we would use the mask 0x00ff: pt_address virtual_address = 0 xc10d ; pt_offset offset = virtual_address & 0 x00FF ; // offset is 0 x0d Note the use of the bitwise and operator &, which uses the mask to zero out the first eight bits and leave the last eight bits alone.To isolate higher order bits you can use a shift right operation move the bits in question to the right, discarding any bits that follow them. If we want to isolate the page number in a virtual address we would need to shift it eight bits to the right: pt_address virtual_address = 0 xc10d ; pt_index page_num = virtual_address >> 8; // page_num is 0 xc1The >> operator is used to shift bits to the right. You can use the * CSCI 4100 * Assignment 7 * Test code for virtual address space simulation */ #inc lude < stdio .h > #inc lude ” va_space . h ” in t main () { /* Display the page table */ page_table table ; pt_display ( table ); puts ( ” ” ); /* Display a page table entry */ pt_index page_num = 0 xb1 ; pt_display_entry ( table , page_num ); puts ( ” ” ); /* Display an address */ pt_address virtual_address = 0 xb18f ; pt_display_address ( ” virtual address ” , virtual_address ); puts ( ” ” ); return 0; } What this will do is demonstrate how to use the three functions I have already implemented for you. You will not want this code in your final version of the file, but you may use parts of it in the course of your testing. The next thing I recommend is implementing and testing each of the functions one at a time. Here are some recommendations: • Start with pt_init. Display the the page table after calling it. • Work on the pt_set and pt_clear functions next. Display the page table entry you are modifying after each one to see how it changes. • Work on pt_dirty, pt_present, and pt_accessed and use these along with your pt_set and pt_clear functions. • Implement pt_map and pt_allocated and pt_not_permitted and test them with a variety of permissions. • Implement pt_translate, and test all of the scenarios described earlier. 4 What to Hand In You must hand in a zip file containing the source files va_space.h, va_space.c, test_va_space.c. Your source files should have comments at the top listing your name, CSCI 4100, Assignment 7, and a brief explanation of what the program does. Download the source files to your local machine, put them into a zip file then upload the zip file to D2L in the dropbox called Assignment 7. See Assignment 6 for instructions on how to do this. 5

$25.00 View

[SOLVED] Csci 4100 – assignment 6 – threads and locks

Implement a bounded buffer using threads and locks. Required Reading PoCSD 5.2For this assignment you will be implementing a bounded buffer using threads and locks and testing it with multiple senders and receivers.The Bounded Buffer I have provided structures and prototypes for your bounded buffer in the file bbuff.h. You will need to implement the functions I have specified in a file called bbuff.c. There are two structures: • bb_msg is a structure that represents a simple message. It has two fields: t_id represents the id number of the thread that is sending the message and m_id represents the id number of the message itself. • bbuff is a structure that represents the buffer itself. It is based on the bounded buffer with locks from Section 5.2 of the PoCSD textbook. Note that it uses a predefined value BUFFER_SIZE to represent the number of messages that can be stored in the buffer. There are three functions having to do with messages: • bb_init_msg is used to initialize a message with a given thread id and message id. It is passed a pointer to a message that has already been allocated in memory. • bb_copy_msg is used to copy the contents of one message (the source) into another message (the destination). Both messages are passed as pointers and have already been allocated in memory.• bb_display_msg is used to display the contents of a message along with the id of the receiving thread to standard output. This can be done using the printf function, which uses format codes to insert values into a string. For example: printf ( ” num1 is % d and num2 is % d . ” , num1 , num2 ); will display the following if num1 has a value of 5 and num2 has a value of 8: num1 is 5 and num2 is 8. There are three functions having to do the bounded buffer: • bb_init is used to initialize a bounded buffer. The in and out variables are initialized to zero. See the section below on POSIX Threads and Locks for how to initialize the lock. • bb_send is used to send a message to the buffer. It should do the following: 1. Acquire the buffer lock. 2. While the buffer is full, release the lock, then acquire it again so that a receiving thread can access the buffer. 3. Copy the message from the bb_msg structure provided to the correct location in the buffer using the bb_copy_msg function. 4. Increment the buffer’s in member variable. 5. Release the buffer lock. • bb_receive is used to receive a message from the buffer. It should do the following: 1. Acquire the buffer lock. 2. While the buffer is empty, release the lock, then acquire it again so that a sending thread can access the buffer. 3. Copy the message from the correct location in the buffer to the bb_msg structure provided using the bb_copy_msg function. 4. Increment the buffer’s out member variable. 5. Release the buffer lock. POSIX Threads and Locks The standard thread library for UNIX-based systems is POSIX Threads (aka Pthreads.) To use this library you will need the following include statement: #inc lude < pthread .h > To create and use a thread you must do the following: 1. Declare a variable of type pthread_t. 2. Write a function whose argument and return value are both of type void * (this means the function can take and return pointers to anything.) 3. Create a structure that can hold all of the information that the thread will need to execute, and create an instance of this structure containing the information for this thread. 2 4. Start the thread using the following function call: pthread_create (& my_thread , NULL , my_function , & args ); where my_thread is the thread variable from step 1, my_function is the name of the function from step 2, and args is the structure from step 3. 5. Wait for the thread to complete using the following function call: pthread_join ( my_thread , NULL ); The POSIX thread library also has support for locks that can guarantee mutually exclusive access to shared data. To create and use a lock you must do the following: 1. Create a variable of type pthread_mutex_t. 2. Initialize this variable using the following function call: pthread_mutex_init (& my_lock , NULL ); 3. When the currently running thread needs to acquire the lock, use the following function call: pthread_mutex_lock (& my_lock ); 4. When the currently running thread needs to release the lock, use the following function call: pthread_mutex_unlock (& my_lock ); Testing the Bounded Buffer In addition to the bounded buffer code above you must also write code to test your bounded buffer with multiple sending and receiving threads. This functionality should be implemented in a file called thread_tester.c. I have provided a structure and three prototypes to help you do this. The t_args structure is used to store all of the arguments that will be required for a sending or receiving thread to get started. It contains the following data members: • t_id is the id number for the thread. • num_msgs is the number of messages for the thread to send or receive. • buffer is a pointer to the buffer that the thread is to use in order to send or receive messages. A structure of type t_args can be initialized using the t_args_init function. This function sets all of the fields of the t_args structure using the given parameters. The send_msgs function is executed by a sending thread. It must do the following: 1. Cast the void pointer args to a pointer to a t_args structure using the following statement: s tru c t t_args * real_args = ( s tru c t t_args *) args ; 2. Declare a bb_msg structure. (Note that in C you have to include the keyword struct when declaring a structure.) 3 3. Send the number of messages specified in the t_args structure by repeatedly doing the following: (a) Initialize the bb_msg structure with the appropriate thread id and message id using bb_init_msg. (b) Send the message to the buffer in the t_args structure using bb_send. 4. Return NULL. The receive_msgs function is executed by a receiving thread. It must do the following: 1. Cast the void pointer args to a pointer to a t_args structure. 2. Declare a bb_msg structure. 3. Receive the number of messages specified in the t_args structure by repeatedly doing the following: (a) Receive the message from the buffer in the t_args structure using bb_receive. (b) Display the message along with the thread id from the t_args structure using bb_display_msg. 4. Return NULL Your main function should do the following: 1. Declare a pthread_t variable for each of the senders and the receivers. 2. Declare a bbuff structure and initialize it using bb_init. 3. Declare a t_args structure for each of the sending and receiving threads and initialize them using t_args_init. The number of messages sent or received by each thread is up to you, but the total number of messages sent should equal the total number of messages received. 4. Start each of the sending threads using pthread_create, the send_msgs functions, and the appropriate t_args structure. 5. Start each of the receiving threads using pthread_create, the receive_msgs function, and the appropriate t_args structure. 6. Wait for each of the sending and receiving threads to complete using pthread_join. Note that in order for the threads to run concurrently you must “create” all of the threads before you “join” any of the threads. Compiling and Running Your Code To compile this code you should use the gcc compiler on the Linux server like you did for Assignment 3, only this time you will need to include all of your .c files as command line arguments and explicitly tell the compiler to link with the POSIX thread library: gcc -lpthread -o thread_tester thread_tester.c bbuff.c 4 Here is an example of a run of the code using 3 senders and 4 receivers and a total of 24 messages: ./thread_tester [sending thread: 1, message 0, receiving thread: 0] [sending thread: 1, message 4, receiving thread: 0] [sending thread: 1, message 1, receiving thread: 1] [sending thread: 1, message 6, receiving thread: 1] [sending thread: 1, message 7, receiving thread: 1] [sending thread: 0, message 0, receiving thread: 1] [sending thread: 0, message 1, receiving thread: 1] [sending thread: 2, message 0, receiving thread: 1] [sending thread: 1, message 3, receiving thread: 3] [sending thread: 2, message 1, receiving thread: 3] [sending thread: 2, message 2, receiving thread: 3] [sending thread: 0, message 2, receiving thread: 3] [sending thread: 1, message 5, receiving thread: 0] [sending thread: 2, message 3, receiving thread: 0] [sending thread: 0, message 4, receiving thread: 0] [sending thread: 0, message 5, receiving thread: 0] [sending thread: 0, message 3, receiving thread: 3] [sending thread: 0, message 6, receiving thread: 3] [sending thread: 1, message 2, receiving thread: 2] [sending thread: 0, message 7, receiving thread: 2] [sending thread: 2, message 4, receiving thread: 2] [sending thread: 2, message 5, receiving thread: 2] [sending thread: 2, message 6, receiving thread: 2] [sending thread: 2, message 7, receiving thread: 2] What to Hand In Your source files should have comments at the top listing your name, CSCI 4100, Assignment 6, and a brief explanation of what the program does. Download the source files to your local machine, put them into a zip file then upload the zip file to D2L in the dropbox called Assignment 6. If you don’t have access to a zip archiver you can use the following commands to create a zip archive on the linux server: $ mkdir yourlastnameAssign6 $ mv thread_tester.c bbuff.c bbuff.h yourlastnameAssign6 $ zip -r yourlastnameAssign6.zip yourlastnameAssign6 This will create a zip file called yourlastnameAssign6.zip which you can download to your local machine.

$25.00 View

[SOLVED] Csci 4100 – assignment 5 – writing a simple shell

Write a Linux shell using the POSIX process interface. Required Reading Linux – Chapter 5For this programming assignment you are going to implement a simple shell called turtle in C. This shell will not be able to implement pipes or redirects, but it will be able to execute any Linux command with any number of command line arguments.The shell should repeatedly prompt the user for a command then execute that command, unless the user types exit in which case the shell should exit sucessfully (using exit(0)), or the user enters only whitespace in which case the shell should prompt the user again.If the user does not type exit or a blank line the shell should break up the line of text the user entered into an array of C-strings. Here is a sample of what running your shell might look like: [colemann@apmycs2 ~]$ ./turtle > ls colemanAssign5.c turtle > ls -l total 32 -rw-r–r– 1 colemann staff 2146 Sep 14 16:04 colemanAssign5.c -rwxr-xr-x 1 colemann staff 9076 Sep 14 16:05 turtle > > fnord turtle: command fnord not found. > exit [exiting turtle shell] 1 I have provided the following functions to get you started: • read_line(line) – reads a line of text from input and stores it in a string. • is_blank(str) – returns true (1) if a string contains only whitespace, false (0) otherwise. • parse_args(cmd, argv) – takes a command line and breaks it up into a sequence of strings containing the command and the arguments, then stores the strings in the array provided. I have also defined the following constants using the #define preprocessor statement:• MAX_LINE – the maximum number of characters allowed in a single line. Use this as the size when you declare a character array to represent the string to pass to read_line. • MAX_ARGS – the maximum number of arguments (including the command) that may be used in a command line. Use this as the size when you declare an array of C-strings to represent the array of arguments to pass to parse_args.To execute a command you must do the following: • Use the fork function to fork off a child process. The fork function takes no arguments and returns a value of type pid_t that can be treated like an integer value. WARNING: be very careful with using fork in a loop. If you are not careful you will fork too many processes for your shell to handle.• Check to see if the current process is the child or the parent by checking the return value of fork. If the return value is 0, the current process is the child process. Otherwise, it is the parent process. • The parent process should call the wait function with a single argument of NULL to wait for the child to complete. • The child process should call the execvp function with two arguments: – The name of the command being executed (argument 0 of the array.) – The entire array of command line arguments.If execvp succeeds, the process will no longer be running the shell code. This means that the next line is executed only when execvp fails. If this is the case, display an error message and terminate the child process by calling exit(1). Displaying Output to the Console In previous assignments I suggested using puts to display output to the console. puts ( ” Hello World ! n ” ); If you want to insert a C-string into your output you can use the printf function with the special format code %s and provide the string as an extra argument: printf ( ” Hello % s ! n ” , name ); We also used the fputs function with the stream stderr to write to standard error: fputs ( stderr , ” Something went wrong . n ” ); If you want to insert a C-string into your error message you can use fprintf: fprintf ( stderr , ” Something went wrong with % s . n ” , str ); 2 String Comparison When you are checking to see if the user has entered the exit command it may be tempting to do something like this: i f ( line == ” exit ” ) // display message and exit program This will not work because the == operator compares the addresses of the strings, not the contents of the strings. Instead you will need to use the strcmp function. This function takes two strings as arguments and returns zero if they are the same: i f ( strcmp ( str1 , str2 ) == 0) puts ( ” The strings are the same ” ); Compiling Your Code Your source file should be called yourlastnameAssign5.c except with your actual last name. To compile this code you should use the gcc compiler on the Linux server. To create an executable file called turtle use the following command: gcc -o turtle yourlastnameAssign5.c What to Hand In Your source file should have comments at the top listing your name, CSCI 4100, Assignment 5, and a brief explanation of what the program does. Download the source file to your local machine, then upload it to D2L in the dropbox called Assignment 5. 3

$25.00 View

[SOLVED] Csci 4100 assignment 4 the posix file interface

Write a Linux utility program using the POSIX file interface. Required Reading Saltzer & Kashoek 2.2-2.3For this programming assignment you are going to implement a simple C version of the UNIX cp program called monkey. The cp program is used to copy files and has many command line options. The monkey program will just copy a file without all of the fancy options. The correct usage of your program should be to execute it on the command line with two command line arguments: the file to be copied (the source file) and the new file to be created (the destination file.) However, your program should also respond well when it is used incorrectly.Here is what your program will need to do: 1. Create a buffer to store the data to be copied. This should be an array of 4096 characters (the size of a file block.) 2. Check to see if the program was given the correct number of arguments. If not, display a usage message and exit the program.3. Open the source file as read-only. If there is an error opening the source file, display an error message and exit the program. 4. Create the destination file. If there is an error creating the file, display an error message and exit the program.5. Do the following until the entire file to be copied has been read: (a) Read the next 4096 bytes from the source file into the buffer. (b) Write however many bytes were actually read into the buffer to the destination file. 6. Close both of the files. 1 The POSIX File Interface To use the POSIX file interface you must add two more include statements to the ones used in Assignment 2: #inc lude < unistd .h > #inc lude < fcntl .h > To create a new file you must use the creat function: fd = creat ( filename , mode ); • The first argument is a C-style string representing the name of the file to be created. • The second argument is an octal representation of the mode or permissions for the file (for example: 0644 means that the file will be readable by everyone but only writable by the user.) • The return value is a file descriptor number (an int), which must be used when reading from, writing to, or closing the file. If there was an error creating the file, the return value will be -1. To open an existing file you must use the open function: fd = open ( filename , how ); • The first argument is a C-style string representing the name of the file to be opened. • The second argument is a flag indicating how the filed should be opened. The options for this argument are O_RDONLY for read-only, O_WRONLY for write-only, and O_RDWR for read and write. • The return value is the same as the return value for creat. To read from a file you must use the read function: chars_read = read ( fd , buffer , num_bytes ); • The first argument is the file descriptor returned by creat or open. • The second argument is a character array where the contents of the file will be stored. • The third argument is the number of bytes to attempt to read from the file. • The return value is the number of bytes actually read, or -1 if there was an error reading the file. If the end of the file has been reached, the return value will be 0. To write to a file you must use the write function: chars_written = write ( fd , buffer , num_bytes ); • The first argument is the file descriptor returned by creat or open. • The second argument is a character array containing the data to be written. • The third argument is the number of bytes to attempt to write to the file. • The return value is the number of bytes actually written, or -1 if there was an error writing the file. To close a file you must use the close function: result = close ( fd ); • The argument is the file descriptor returned by creat or open. • The return value is 0 if closing the file was successful and -1 if there was an error.Displaying Error Messages In Assignment 2 we used fputs to display error messages. This is still the best way to generate a usage message: i f ( argc != 3) { fputs ( ” Usage : monkey source destination n ” , stderr ); exit (1); } When it comes to the other error messages, C provides a better way to generate errors through the perror function: in_fd = open ( argv [1] , O_RDONLY ); i f ( in_fd == -1) { perror ( argv [1]); exit (1); } This will display the name of the file provided along with a description of the most recent error encountered: $ ./monkey nosuchfile.txt nosuchfile_copy.txt nosuchfile.txt: No such file or directoryCompiling and Running Your Code Your source file should be called yourlastnameAssign4.c except with your actual last name. To compile this code you should use the gcc compiler on the Linux server: gcc -o monkey yourlastnameAssign4.c If your program compiled, you should see an entry for monkey when you execute the ls command. When you run your code, try it using both text files and executable files. You can use diff to check if the copied text files are correct, and cmp to test if the copied executable files are correct. Both of these commands will display no output if the files are the same. Here are some examples of what several runs should look like: $ ./monkey myfile.txt myfile_copy.txt $ diff myfile.txt myfile_copy.txt $ ./monkey monkey monkey_copy $ cmp monkey monkey_copy $ ./monkey myfile.txt Usage: monkey source destination $ ./monkey nosuchfile.txt nosuchfile_copy.txt nosuchfile.txt: No such file or directory $ ./monkey myfile.txt . .: Is a directoryWhat to Hand In Your source file should have comments at the top listing your name, CSCI 4100, Assignment 4, and a brief explanation of what the program does. Download the source file to your local machine, then upload it to D2L in the dropbox called Assignment 4.

$25.00 View

[SOLVED] Csci 4100 assignment 3 writing a bash shell script

Write a bash shell script. Required Reading Linux – Chapters 8 and 10For this assignment you must write a bash shell script that keeps track of a list of email contacts by storing them in a text file called contacts.dat. The source file should be called yourlastnameAssign3.sh, except with your actual last nameYour program should present a menu to the user with the following options: 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the programThe first option should prompt for a full name and check to see if there is already an entry containing this name in contacts.dat. If there is already an entry for this name it should display a message indicating that an entry already exists. If not, it should prompt for the email address, then add a line contacts.dat containing the name followed by a comma, followed by the email address.The second option should prompt for a full name, then remove the any lines from contacts.dat containing this name. The third option should prompt for a full name, then display any lines from contacts.dat containing this name. The fourth option should display the contents of contacts.dat sorted by last name.The fifth option should exit the script If the user chooses any of the first four options, once the action has been performed the menu should be displayed again and the user should be prompted to make another choice.Helpful Commands and Options Your shell script will need the file called contacts.dat to exist in order to work. If you execute the following command at the beginning of your script: touch contacts.datThis will create an empty text file the first time the script runs, and verify that it exists when you run the script again. The read command prompts for input and stores it in a variable. You can use the -p option to provide the user with a prompt: read -p “Enter your name: ” nameThis will store whatever the user enters in the variable name. The grep command will display the lines in a file that match a given pattern. You can suppress the output using the -q option if all you want is to determine if such a line exists: if grep -q pattern file then # do stuff else # do other stuff fiYou can display all of the lines that do not match a pattern using the -v option: grep -v pattern oldfile > newfile This is one way to remove lines matching a pattern from a file. The sort command sorts a file alphanumerically by line. If you want to sort by a specific field of a file containing a sequence of records, you can use the -k option: sort -k 1 file # sorts by first field sort -k 2 file # sorts by second field Testing and Debugging Shell Scripts The easiest way to debug a shell script is to test each command individually using the shell. If you want to know the exit status of a command, you can display the special variable $?, which evaluates to the exit status of the most recently executed command: $ ls nosuchfile.txt ls: nosuchfile.txt: No such file or directory $ echo $? 1 If more substantial debugging is required you can run bash directly using the -x option: $ bash -x hello.sh + echo ‘Hello World!’ Hello World! All executed commands will appear in a line with a + at the beginning before they are executed. 2 Sample Run Your output should look similar to the following: Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 1 Enter a name: Nicholas Coleman Enter an email address: [email protected] Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 1 Enter a name: John Nicholson Enter an email address: [email protected] Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 4 Nicholas Coleman, [email protected] John Nicholson, [email protected] Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 1 Enter a name: Nicholas Coleman There is already an entry for Nicholas Coleman 3 Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 3 Enter a name: Nicholas Coleman Nicholas Coleman, [email protected] Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 2 Enter a name: Nicholas Coleman Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 4 John Nicholson, [email protected] Select one of the following options: ———————————— 1. Add a contact 2. Remove a contact 3. Find a contact 4. List all contacts 5. Exit the program Enter a choice (1-5): 5 Thanks for using this program! What to Hand In Download the source file yourlastnameAssign3.sh to your local machine, then upload it to D2L in the dropbox called Assignment 3. 4

$25.00 View

[SOLVED] Csci 4100 assignment 2 writing a linux utility program

Write a Linux utility program. Required Reading None, but you may find the links to the C language and C library documentation helpful.For this programming assignment you are going to implement a simple C version of the UNIX cat program called kitten. The cat program allows you to display the contents of one or more text files. The kitten program will only display one file. The correct usage of your program should be to execute it on the command line with a single command line argument consisting of the name you want to display.However, your program should also respond well when it is used incorrectly. Processing Command-Line Arguments Unless you have done Linux programming before you probably haven’t needed to process command line arguments. A typical C program has a main function that looks like this: in t main () { // body of main function } This works just fine if your program does not take any command line arguments. If it does, as is the case with kitten, you will need access to those arguments. You will need to write your main function like this: in t main ( in t argc , char * argv []) { // body of main function }1 The argc parameter is the number of command line arguments provided to the program including the name of the command itself. The kitten program should have two command line arguments if it is used correctly: the name of the command and the file to display. The argv parameter is an array of C-strings, or nullterminated character arrays. This means that argv[0] is the name of the program, argv[1] is the first command line argument, argv[2] is the second command line argument, and so on. The kitten program should display a usage message to standard error and exit the program using exit(1) if argc is anything other than 2. Otherwise it should use the C-string contained in argv[1] as the name of the input file to open. Note that exit function requires the following preprocessor statement: #inc lude < stdlib .h > Streams The standard way to deal with files, the console, and other sources of input and output is by using streams. For historical reasons, the data type used to deal with a stream, whether or not it uses a file, is FILE *. Working with streams requires the following preprocessor statement: #inc lude < stdio .h >To declare a stream variable use the FILE * data type: FILE * stream ; To open a file use the fopen function: stream = fopen ( filename , opentype ); • fopen has two parameters: filename is the name of the input file as a C-string, and opentype is a C-string containing information about how the file is to be opened. • If the file is to be opened for reading only, the second argument should be “r”. • fopen returns a value of type FILE * if the file opened successfully, and NULL otherwise. • If your program can not open the file, display a message that the file was not found to standard error and exit the program. To read a single character from a file, use the fgetc function: character = fgetc ( stream ); • fgetc has one parameter: the stream that was returned by fopen. • fgetc returns the character read if it was successful and the special EOF character if it was not successful. To close a file use the fclose function: fclose ( stream ); • fclose has one parameter: the stream representing the file to be closed. • fclose returns 0 if the file closed correctly and EOF if it did not. The latter case is rare, so the return value is typically ignored. 2 To write a string to standard output use the puts function: puts ( string ); • puts has one parameter: the C-string to be printed. Note that if you want a newline to be displayed you have to use the special character at the end of the string. • puts returns a non-negative value if successful and EOF if unsuccessful. The return value is typically ignored.• You will not need this function for this assignment, but it may be helpful to you for debugging purposes. To write a string to standard error use the fputs function: fputs ( string , stream ); • fputs has two parameters: string is the C-string to be printed, and stream is the stream representing the destination of the output. • To print to standard error, use stderr as the second argument. • fputs returns a non-negative value if successful and EOF if unsuccessful. The return value is typically ignored. To write a single character to the console use the putchar function: putchar ( character ); • putchar takes a single argument: the character to be printed. • putchar returns the character if it printed successfully and EOF if it does not. The return value is typically ignored. Linux Development Tools You should not be using Windows development tools for this class! Instead, you should use the development tools provided on the Linux server. Writing Your Code The best way to write a Linux program is to use one of the many text editors provided on a typical Linux distribution. If you are using the Linux server you have several options, but the nano text editor mentioned in Assignment 1 is probably the simplest. If you want to use a text editor with more features for writing source code you can try using vim (see Chapter 6 of the Linux book) or emacs (see Chapter 7 of the Linux book.)Compiling Your Code Your source file should be called yourlastnameAssign2.c except with your actual last name. To compile this code you should use the gcc compiler on the Linux server. To create an executable file called kitten use the following command: gcc -o kitten yourlastnameAssign2.c If your program compiled, you should see an entry for kitten when you execute the ls command. 3 Running Your Code Since your home directory on the Linux server is not in your execution path, you will need to specify the file you are executing directly by putting a ./ before the name of the executable.Here are some examples of what several runs should look like: $ ./kitten foo.txt This is a text file that I created in a text editor in order to test out the kitten program. $ ./kitten usage: kitten $ ./kitten foo.txt otherFile.txt usage: kitten $ ./kitten no_such_file.txt error: file not found What to Hand In Download the source file yourlastnameAssign2.c to your local machine, then upload it to D2L in the dropbox called Assignment 2. 4

$25.00 View

[SOLVED] Csci 4100 – assignment 1 – linux commands

Write and execute basic Linux command lines. Required Reading Linux – Chapters 1-3 Instructions For this assignment, you will need to log in to the Linux server, create some files, and execute a sequence of commands. You must hand in a transcript of your session as a text file generated by the script command.Create a file called words1.txt consisting of the following words in the following order, each on its own line: palindrome avocado tarantula nettle lemonade development avocado farthing Create a file called words2.txt consisting of the following words in the following order, each on its own line: palindrome tension avocado tarantula xylophone lemonade development avocado javelina godspeed 1 Once you have created these two files, use the script command to record the next part of your session.Execute commands that do the following (in this order): 1. Display the contents of words1.txt immediately followed by the contents of words2.txt without any gap between them using a single command. 2. Compare the two files and display the differences between them. 3. Display the contents of words1.txt in sorted order. 4. Display the contents of words2.txt in sorted order. 5. Display the contents of words1.txt in sorted order without duplicates. 6. Display the contents of words2.txt in sorted order without duplicates. 7. Display the first four lines of words1.txt. 8. Display the last four lines of words1.txt. 9. Display the first four lines of words1.txt in sorted order. 10. Sort words1.txt and display the first four lines of the sorted results. (Note that this is asking for something different than problem 9.) When you have executed all of these commands, type exit to exit the script program.Your session should be captured in a file called typescript. This file will contain everything you typed including characters you deleted and the backspace characters that deleted them. To make this look better execute the following command with your actual last name substituted for yourlastname: cat typescript > yourlastnameAssign1.txt Writing Text Files The easiest way to create a text file on Linux is to use a text editor. The simplest text editor available is probably nano, which can be started by typing nano at the command line.You can then write the text file, type control-o to save it, and control-x to exit the program. You can also open an existing file by typing nano at the command line (with the actual name of the file instead of .) What to Hand In Download yourlastnameAssign1.txt to your local machine, then upload it to D2L in the dropbox labelled Assignment 1. 2

$25.00 View

[SOLVED] Cs2070 assignment 14: space craft

In this program, you will be creating an application to hold various types of space craft.Name your project FirstnameLastnameAssignmentNumberA space craft is a generic term for an object in space which holds people. The SpaceCraft class needs to be a public abstract class. People sit in seats. Your SpaceCraft class should have the fields:A space station doesn’t move in space. It houses people. The SpaceStation class needs to extend SpaceCraft. It should have the following fields:A space shuttle moves people around in space. A space shuttle has engines. The SpaceShuttle class needs to extend SpaceCraft. It should have the following fields:Your main method should begin with an empty ArrayList of SpaceCraft objects.Write a menu based application which does the following:In this example run, I add Deep Space Station K-12 and the Enterprise to my space craft organizer. Your organizer should behave like this for full credit.Welcome to James Church’s Space Craft Organizer. 1. Add a new space station. 2. Add a new space shuttle. 3. Display count of all space craft. 4. Display count of number of seats. 5. Display description of all space craft. 6. Quit. Enter an option from 1 to 6: 1Enter a new Space Station. Enter the name: K-12 Enter the number of seats: 1000 Enter the number of ports: 1001. Add a new space station. 2. Add a new space shuttle. 3. Display count of all space craft. 4. Display count of number of seats. 5. Display description of all space craft. 6. Quit. Enter an option from 1 to 6: 2Enter a new Space Shuttle. Enter the name: Enterprise Enter the number of seats: 500 Enter the number of engines: 21. Add a new space station. 2. Add a new space shuttle. 3. Display count of all space craft. 4. Display count of number of seats. 5. Display description of all space craft. 6. Quit. Enter an option from 1 to 6: 3There are 2 space craft.1. Add a new space station. 2. Add a new space shuttle. 3. Display count of all space craft. 4. Display count of number of seats. 5. Display description of all space craft. 6. Quit. Enter an option from 1 to 6: 4There are 1500 seats across all space craft.1. Add a new space station. 2. Add a new space shuttle. 3. Display count of all space craft. 4. Display count of number of seats. 5. Display description of all space craft. 6. Quit. Enter an option from 1 to 6: 5All Space Craft. Space Station K-12 has 100 ports. Space Shuttle Enterprise has 2 engines.1. Add a new space station. 2. Add a new space shuttle. 3. Display count of all space craft. 4. Display count of number of seats. 5. Display description of all space craft. 6. Quit. Enter an option from 1 to 6: 6Your source code must include the following documentation:To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 13: write a book library application

In this program, you will be creating a Book Library application. Use the image provided for reference.Book Library gui imageName your project FirstnameLastnameAssignmentNumberThe Book class will maintain four private final fields:The Book class will require two methods, both of which require JavaDoc documentation.public Book(String title, String author, String publisher, int year)This method will associate each of the four parameters with their respective fields. There are no preconditions. The post condition is that the object is created. If you make the constructor before the four fields, NetBean’s Code Fix feature will create the four private final fields with a few mouse clicks.public String getDescription()This method returns a String of the four fields by order of title, author, publisher, and year, with a space character separating each. There are no preconditions or postconditions or parameters. You do have to document the return value.Write a program that will display four Label and TextField pairs, a Button, and a TextArea.This will require the following:The EventHandler for this assignment is rather involved. It should perform these steps, all of which were done inside of a large try block.All of this should be wrapped in a large try block. You should catch a NumberFormatException. When this happens, show a JOptionPane error message, which is identical to what you did in the last homework assignment.Your source code must include the following documentation:To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 12: write a distance converter

In this program, you will be creating a distance conversion program. You’ve probably written one of these in your past classes, but this one will require JavaFX. The emphasis is on the graphical application.You will need these conversion guides.Name your project FirstnameLastnameAssignmentNumberWrite a program that will display an input field. The input field will take a distance in meters. It will then convert that distance into another distance based on unit which is selected via a radio button. Use the reference image blow.Tape measure gui imageThis will require the following:Notes:Be sure to test your application with 4 inputs:Your source code must include the following documentation:To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 10: the car class

Object-Oriented Programming (OOP) is about rethinking how we write code. OOP centers around objects. In this case, the object is a Car. Objects do things. They have a status which can change based on what is doing.This homework assignment has lots of math. It’s simple math, but there’s still lots to compute.For instance, a new car will have an odometer of 0. This is the car’s initial state. After the car drives 10 miles, the odometer will be 10. If it drives 10 more miles, the odometer will be 20. Each time the car is driven, the odometer will increase. It should never decrease.Here are the fields that a Car should have (all of which will be represented with double values).Here’s a few important terms which will be necessary for completing this assignment.Example. My car has a 9 gallon tank and gets 33 miles to the gallon.Name your project FirstnameLastnameAssignmentNumberHave your program do the following.Tips: The only primitive data type that I used in this assignment was double. All inputs were double too. Because everything is a double, you’ll need to display everything to 1 decimal place using printf. Also, you must document your public methods in the Car class with a description, precondition, postcondition, a description of each parameter, and the returned value.Create a class named Car which contains the fields mentioned above.In addition to the fields mentioned above, you’ll need these public methods. The precondition for any method which takes an argument is that the argument must be positive. You’ll have to determine if your method as a postcondition. (As postcondition is any method which changes the object’s fields.) Also, no methods will display anything and you’ll be counted off severely if you have print statements in your Car class.This method will assign gas to the field for the fuel and mpg to the car’s milesPerGallon field. The odometer field will always begin at 0.This method will return the fuel (i.e. the amount of gas left in the tank).This method will return the odometer reading.This method will attempt to drive the car at this speed for this amount of time as long as there is enough gas in the tank. If there’s enough gas or not, update the odometer and return the distance driven. In general, I did these steps.The program should continue to loop until the car’s fuel tank is completely empty.Here’s an example run in which I used the same example from earlier in the assignment.Welcome to Dr. Church’s Car Simulator. Enter the number of gallons of gas in the tank: 9 Enter the car’s miles per gallon: 33 We’ve created a car with 9.0 gallons of gas in the tank and get 33.0 MPG. We will loop while there is gas in the tank.Enter the speed (in miles per hour) at which you will drive the car: 70 Enter the time (in hours) that you drove the car: 3 The car drove a distance of 210.0 miles. The car odometer is at 210.0 miles. There is 2.6 gallons of gas left in the tank.Enter the speed (in miles per hour) at which you will drive the car: 30 Enter the time (in hours) that you drove the car: 0.5 The car drove a distance of 15.0 miles. The car odometer is at 225.0 miles. There is 2.2 gallons of gas left in the tank.Enter the speed (in miles per hour) at which you will drive the car: 50 Enter the time (in hours) that you drove the car: 1.5 The car drove a distance of 72.0 miles. The car odometer is at 297.0 miles. There is 0.0 gallons of gas left in the tank.Your source code must include the following documentation:To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 9: do-it-yourself rock-paper-scissors

In the game Rock-Paper-Scissors, two people (in secret) select on of the three items (Rock, Paper, or Scissors). They compare their selection. Rock beats Scissors, Paper beats Rock, Scissors beats Paper. If they select the same item, it’s a tie.For this assignment, I’d like for you to make your own version of the game with your own set of three items. They could be “dogs, cats, gerbils” or “canoeing, rafting, kayaking” or “planes, trains, and automobiles”. For whatever three items you pick, you have to select one item to beat another item for all three items (much like Rock-Paper-Scissors). It doesn’t have to make sense. Why does paper beat rock, anyway? Don’t answer that.You’ll need to present a menu to allow the user to select their item and you’ll need to have the computer to randomly select an item. (This will require the Random class.)After each item is selected, determine who won (or if there is a tie because you both picked the same item). You’ll need variables to keep track of the results. The results should be displayed after every round. (See my example.)Also after every round, you should ask the user if they would like to continue.When you are done, you should refactor your code using NetBean’s “Introduce Method” feature to break the game into private helper methods. The final source code should be a readable document.This is a variation on problem 17 on page 317 in the textbook. Like the textbook, I use the Random class to select a number from 1 to 3 for the computer’s selection.In fact, I am going to provide my entire main method. Your code should be as readable as mine.public static void main(String[] args) { String response = “yes”;Scanner keyboard = new Scanner(System.in); Random rng = new Random();greetTheUser(); displayTheRules();while (“yes”.equals(response.toLowerCase())) { int cpuChoice = getCPUChoice(rng);diplayTheItemChoices(); int userChoice = getUserChoice(keyboard);displayTheComputerChoice(cpuChoice); displayWhoWon(userChoice, cpuChoice); response = askUserIfTheyWouldLikeToPlayAgain(keyboard); }displayClosing(); }Name your project FirstnameLastnameAssignment9Have your program do the following.Your source code must include the following documentation:Welcome to the game of Dog-Cat-Gerbil. Gerbil beats Cat. Cat beats Dog. Dog beats Gerbil. Let’s play! Enter a guess: 1: Dog 2: Cat 3: Gerbil 1 The computer picked cat. You won! Should we play again? [Yes] yes Let’s play! Enter a guess: 1: Dog 2: Cat 3: Gerbil 2 The computer picked gerbil. Computer won. Should we play again? [Yes] yes Let’s play! Enter a guess: 1: Dog 2: Cat 3: Gerbil 3 The computer picked cat. Computer won. Should we play again? [Yes] no Thanks for playing!To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 8: word length

In two of the videos currently on the course website, the procedure on how to open a file for both reading and writing is done. In this assignment, you should prompt the user for a filename to read and a filename to write. You should then read from the file for reading (an example will be provided along with this assignment) and then you should write to the file for writing these contents:Each word and word length should be printed on a line all by itself.The libraries used to open a file for reading are:The libraries used to open a file for writing are:Please watch the videos and read Chapter 4 for a detailed look at how to use the libraries. The libraries also require that you throw certain exceptions. The NetBeans “Fix Code” feature will properly throw these errors in your code. You are always encouraged to learn the features of NetBeans to make your programming life easier.Once you begin reading from the input file, you’ll have to loop while (hint, hint) there is another token in the file to read. The method hasNext will detect if there is another token to read in a file. See the example in the book on page 241 and 242. You’ll read in the book’s example about how to read an entire line using nextLine. I don’t want you to do that for this assignment. I want you to read in a single word. This can be accomplished using the next method. The next method returns a String object.Once you have your word, you need to print that word and the word’s length. You can determine the length of a String object using “word.length()”.The input file provided in this assignment is the text of the Gettysburg Address. The file contains only lowercase letters and one space per word and no punctuation. There are several lines in the file representing the paragraphs of the original speech. That should not impact your program. Here are the first ten words of the file:four score and seven years ago our fathers brought forthName your project FirstnameLastnameAssignment8Have your program do the following.My solution (not including the required documentation) was 37 lines of code. If you go over 50, you should probably ask questions in the discussion or send an email to your instructor.Your source code must include the following documentation:The example run is kinda boring since it only displays a few prompts and then quits.Welcome to Dr. Church’s Sentence Splitter. Enter a file to read: gettysburg.txt Enter a file to output: out.txtThe contents of out.txt will be each word and that word length. Here are the first 10 entries.four 4 score 5 and 3 seven 5 years 5 ago 3 our 3 fathers 7 brought 7 forth 5To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 7: the restaurant bill (part 2 of n)

The restaurant was happy with the bill tool that you wrote for them, but they need some enhancements. Everyone who shows up at the restaurant orders a entrée, a drink, and a dessert. You need to write a program which will prompt for the names of each of the three meals and their prices. You will then prompt for the name of the server. Finally, you will sum the total of the bill, compute the tax (like last time, it’s 7%) and then present the low, medium, and high tip suggestions. You are encouraged to edit your assignment 3 since there is so much overlap with this assignment and assignment 3.Name your project FirstnameLastnameAssignment7Have your program do the following.Since every numerical value in this assignment is a dollar amount, you should display all floating point numbers with a display width of 6 spaces and rounded to 2 decimal places. Also, make sure all dollar amounts begin with a dollar sign. (See the example below.) See page 167 in the textbook for an example of a number being rounded using 2 decimal places. Each of the leading strings needs to be displayed using 20 spaces and right justified. Rather than space out everything and counting spaces on the screen, use the format code to display a string using 20 spaces.Your source code must include the following documentation:Welcome to Dr. Church’s Restaurant Bill Tool. Part 2 Enter the price of the entree: 8.5 Enter the price of the drink: 1.99 Enter the price of the dessert: 3.5 Enter the name of the server: Hayao Miyazaki Entree $  8.50 Drink $  1.99 Dessert $  3.50 Total $ 13.99 Tax $  0.98 Total w/ Tax $ 14.97 Low Tip $  2.25 Medium Tip $  2.69 High Tip $  2.99 Your server: Hayao MiyazakiTake special care to make sure that each line is formatted correctly. Even the last line with the server name uses “Your server:” displayed to 20 spaces. You should be using the System.out.printf” method for displaying everything after the initial prompts. (For the initial prompts, I used the regular “System.out.print” method.)To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 6: sorting words

This is a variation on problem number 7 on page 186 in the textbook, except that all names should be unique.Name your project FirstnameLastnameAssignment6Have your program do the following.Notes:Your source code must include the following documentation:Welcome to Dr. Church’s Name Sorter. All names must be unique. Enter the first name: Eve Enter the second name: Alice Enter the third name: BobHere are the sorted names. Alice Bob EveWelcome to Dr. Church’s Name Sorter. All names must be unique. Enter the first name: Alice Enter the second name: Bob Enter the third name: EveHere are the sorted names. Alice Bob EveWelcome to Dr. Church’s Name Sorter. All names must be unique. Enter the first name: Alice Enter the second name: Rebecca Enter the third name: AliceNames one and three are identical.Welcome to Dr. Church’s Name Sorter. All names must be unique. Enter the first name: Alice Enter the second name: Bob Enter the third name: Bob Names two and three are identical.To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View

[SOLVED] Cs2070 assignment 5: test averages

This is a variation on problem number 10 on page 107 in the textbook. Your task is to prompt the user for three test scores. You should then compute the average of the test scores and display the average. The difference between the book’s description and this assignment is that I would like for you to use JOptionPane dialog boxes.This will also require that you parse a String object into a floating point type. You should be using the double type for test scores and averages. As a reminder, the JOptionPane will only return values as String objects. The slides on the course website and Chapter 2 of the textbook will have example code on how to parse String objects into other types.Name your project FirstnameLastnameAssignment5Have your program do the following.Notes:Your source code must include the following documentation:Not yet, but this should be enough to go on.To turn in your application, find the folder containing your entire project (not the folder with the “java” file), zip it up, and turn it in.

$25.00 View