Category: Computer science and IT assignments

Programming

This is a basic C Programming class, so please only basic code. The program needs to be written in the Ch11.c  file.
Before starting, carefully study sort_str(), stsrt(), s_gets(), mod_str(), and format(). You will use the code from all of these functions! The sort_str() function will call the other functions, although you could call mod_str() from s_gets().

Your end goal is to create a program that prints a class roll sheet in alphabetical order. The program prints out the roster like this…

HATFIELD, HEIDI
KAISER, RUSSELL
LIPSHUTZ, HOWARD
PENKERT, DAWN
WRIGHT, ELIZABETH

The user inputs the students’ first name and last names separately but within one loop. The loop should end when the user presses enter on the first name without entering any text. Upon completing entry of data, the output pictured above should display on stdout.

First step: Get all the files working from your sort_str.c file with the following changes: You should be able to enter up to 20 student first names. Also, change the input array to an appropriate size of 18 for the length of the first name. Use  a meaningful name for the storage of first names array. Change prompts as needed. The loop should exit when the user presses enter when inputing the first name without adding any text. Compile and make sure it works from main(). At this point, you should be able to enter and alphabetize a list of up to 20 first names! Alphabetizing the first name is just a test!!! In the end, you will alphabetize the whole name string.

Make changes to convert the first name to all upper case using a function from mod_str(). Compile and test.

Add another array and get input for last name INSIDE the loop for your first names. This last name array will also be an array of 20 elements but with room for up to 25 characters. Again, do not use another loop! Just add code to input the last name to the first loop. The program should now ask the user to input the student’s first name and then last name in that order for each individual. Then the program will loop to continue adding student names until the user presses enter on the student’s first name. Make sure the last name is converted to all caps. You do not need to alphabetize this array, but you may want to print it out to make sure everything is working just as a test.

Last step: Combine last and first into an third array. You need to add the comma, so you may want to use sprintf() for this one. There are other ways. This code is most easily added to the first loop. You just had the user enter first and last names. So the current value of the subscript used for these arrays can be used to combine content and store in the third array.  Alphabetize THIS array (instead of the first name array)  which means you need to send a different pointer to the stsrt() function.  Print out the end result. Test that everything is working on this program.

File System Programming

Goals
For this assignment, you will design you own file system. It should be able to store up to 10,000 files on a medium up to 2GB in size. The maximum size of each file is 200MB. The file system should provide a directory tree with file names composed of arbitrary characters up to 200 bytes long. Each block is 1KB in size, which means your file system will have to handle at least 2,097,152 x 1KB blocks = 2GB.

The file system does not have to be efficient. In particular, you do not need to implement a buffer cache. Your implementation must limit itself to using a fixed size of storage, on the order of 1MB or (much) less for all the tables etc. The actual storage must be moderately efficient, so that most of the space on the “disk” should be available for storage of actual data.

Details
The file system should use the following block read and write operations which will be provided:

typedef char block [1024]; /* each block is 1KB */
int read_block (int block_num, char * block) — returns 0 if the operation is successful, and -1 otherwise
int write_block (int block_num, char * block) — returns 0 if the operation is successful, and -1 otherwise, this function actually writes the block to disk
int dev_open () — returns the device size (in blocks) if the operation is successful, and -1 otherwise
These are implemented in the supplied file, block.cPreview the document. The first block is block number 0. By design, dev_open accesses blocks in a file named my_dev in the current directory. To create the file, use the following command from the shell prompt:

dd if=/dev/zero of=my_dev bs=1024 count=x
where x is the size (in blocks) of your intended device. For example,

dd if=/dev/zero of=my_dev bs=1024 count=131072
gives you a 128MB device (128K blocks), and

dd if=/dev/zero of=my_dev bs=1024 count=250000
gives you a device large enough for the maximum file size that testp4 (described below) tries to build.

WARNING: Make sure you have enough room in your home directory to create a file that large.

Implementation
Your code must implement the following API that is based on (and a simplified version of) the POSIX file API:

int my_open (const char * path) – to open an existing file for reading or writing
int my_creat (const char * path) – to open a new file for writing only (fails if the file already exists)
int my_read (int fd, void * buf, int count) – to sequentially read from a file
int my_write (int fd, const void * buf, int count) – to sequentially write to a file
int my_close (int fd)
int my_remove (const char * path)
int my_rename (const char * old, const char * new)
int my_mkdir (const char * path) – only works if all but the last component of the path already exists
int my_rmdir (const char * path)
void my_mkfs () – checks to see if the device already has a file system on it, and if not, creates one.
A file providing this API, but not implementing it, is provided to you as prog4.cPreview the document. Please modify just this file by filling in all the implementations of the listed functions and other needed ancillary functions (see the next section). The header file, prog4.hPreview the document, is also provided for your convenience along with a simple test program, testp4.cPreview the document. This program runs all the tests unless an optional argument is provided, in which case it runs all the tests on files whose size (in bytes) is less than or equal to the argument. Please go through the code for testp4.cPreview the document to understand how it tests the implementation of the file system for correctness.

NOTE: Of the four files given to you (block.cPreview the document, prog4.cPreview the document, prog4.hPreview the document, testp4.cPreview the document), you should only modify the prog4.hPreview the document and prog4.cPreview the document. The testp4.cPreview the document should not be modified in any way (except of course if you need to make some modifications while testing). The block.cPreview the document should not need to be modified in any way, however if you feel that you can modify it to improve your implementation then you are free to.

Program Guidelines
As mentioned earlier, your program should not aim to do anything very fancy, and so, your choice of structures for i-nodes, directory entries and the superblock should be simple. For example, your code does not need to provide protection, multiple links, access times, or current directories. You also may assume that each file will be opened at most once before it is closed again; i.e. we assume that files have a single pointer for position. On the other hand, you should allow for multiple files (up to 10) to be open at the same time. Keep a simple in-memory table structure to maintain these open file descriptors.

Your code does need to handle “/”-separated paths of arbitrary depth, and so one useful function you may find yourself writing may be to parse paths. You may also want to write some routines to maintain and access block bitmaps on disk (some stubs are provided already in the file prog4.cPreview the document; add more functions as you see fit).

You may also want to implement some ancillary functions for debugging and testing your path traversal code, e.g. to produce a dump of the files under some sub-directory in the file system tree. Above all, keep it simple!

Deliverables
Please make sure that your code runs on the Linux systems in school (on the lab machines, clamshell.rutgers.edu or apps.camden.rutgers.edu). Be very careful if you develop your code on a 32bit system and then move to a 64bit system, some types (like the long are different sizes on different architectures). You can see the difference by looking at the output of sizeof(long) on both a 32bit and 64bit system, they will be different sizes. This is important when you create your structures, because they need to be exactly 1K in size, so you may need to pad your structure to make it the right size.

You should be able to compile the testp4 program, by running:
    gcc -o testp4 block.c prog4.c testp4.c
The resulting executable should run without errors. Note that the executable can be supplied with a command line argument (see the file testp4.cPreview the document for details on what it tests). Along with your implementation file, prog4.c, please submit a reasonably detailed design document (in PDF format) called README.pdf that describes your design and implementation strategy.

To read what is stored on your “device”, you may run
    od -t x1 my_dev | more
Don’t worry if the numbers come out backwards (with the least significant bit first); this will happen if you run on little-endian machines such as those using Intel architectures.

Dijkstra map

This is an assignment for an algorithm course in uni. The course focuses on optimizing algorithms. This is a Java project that requires the algorithm to read a file with points that represent places (cities) and what other places they are connected with, then show them as points (vertex) and roads (edges) on an interface. When clicking on a city and any other city the algorithm should highlight the shortest path taken from that city to the other using Dijkstra, and calculate that path’s distance and show it to the user with any other info needed.
attached is a file with a pdf that explains the assignment in details, please check it out.
In short we need to create a map that the user can interact with to find the best shortest path.
because this is an algorithm assignment please focus on commenting on the code, and if you can explain the algorithm you decide to use for me.

Python Programming Work

Paste your solutions to the exercises, and your reflective commentary, into a single Word document and upload it here. When pasting in Python code, make sure you use a fixed width font such as Courier new in order to preserve indentation.

these are the instructions

Java Data Structures Assignment – Heaps

Attaching the zip file with all required files, including specification sheet with instructions on assignment.

Ignore the ‘readme.txt’ file, I will complete that, just do all the programming. There are ~25 methods to write total. Giving ample time for completion, ask me if you have any questions.

C++

Each experiment should be documented with a separate C++ file + output screen. You can add some notes next to the lines documenting what the statements are doing. Please, format the source file when you insert it to the Word document file for readability. I will consider the format in grading!

Plagiarism is considered academic dishonesty and is subject to a sanction such as getting zero for all lab works or even getting an F grade in the course.

Assignment 3

1)
Create an OpenGL Application with a window that has a title of (Ghalia) and of size 700×500
Change the background color to anything other than black or white
Draw an abstraction of Palm trees, beach, sand and sun.
Specify the colors of your different objects

2)

Identify two main objects to be the objects of interest in your program.  Which is the palm tree and water of the beach.

Model Activation:  
The user would press a key to activate a model such that the following transformations would be only applied to the active model
 
1:  Palm tree active
2: Water active
3: both models active.

Transformations:
Implement the following transformations. Note, these transformations would be only applied to the active model based on the selection from previous step. Add keyboard interaction for the following keys:

Arrow up: translate along the positive y axis
Arrow down: translate along the negative y axis
Arrow right: translate along the positive x axis
Arrow left: translate along the negative x axis
Arrow up and SHIFT : translate along the negative z axis
Arrow down and SHIFT : translate along the positive z axis
x or X : rotate around the x axis with 10 degrees
y or Y : rotate around the y axis with 10 degrees
z or Z : rotate around the z axis with 10 degrees
r or R: to reset the active object(s) to its initial position

Animation
Implement animation of your choice on the active model(s).

Connect 4

Connect 4 Game with multiple clients connecting to it, as well as it having a chat for the players to communicate. This youtube video is basically a good idea of what I would like to reference to.
https://www.youtube.com/watch?v=TSkjy7387RU&t=14s

Python: Graphical User Interface

Task: Graphical User Interface
Task description: Cannon game

You will use a variation of the code from the last exercise to create a cannonball game. The player should put strength and angle of the cannon to hit an object on the ground a distance away from the cannon. Use the techniques from the last exercise to calculate the trajectory of the cannonball. There should be an option box for whether the game will use air resistance or not.

To be able to render the results of the integrator as an animation instead of a regular plot, there is an alternative integrator added to the exercise. This integrator returns its results through repeated calls to the next () method. So every time you update the animation, call next () to get out the next value from the integrator.

An example of the GUI is shown below. The cannon is at the bottom left. The red square is the goal the player must hit. The black balls are cannonballs the player shoots. The white box is an obstacle which the player must shoot over to hit the target.

attachments: demo: showing how it could/should look and the zip containing the integrator and classes for air resistance or not

Basic Game Development in Python

Requirements:

For this assignment, you are tasked to develop a game called Guess the Word, which allows two players to participate in turn. The game should contain the following key elements of play:

1.    The game should start by prompting Player 1 to enter a word of their choice via the Python console screen for Player 2 to guess (assume that Player 2 looks away and does not see).
2.    The Python console should then be cleared so as to hide the word from Player 2.
3.    Player 2 must now guess the word by typing one letter into the Python console following a suitable prompt.
4.    For each guess, the game needs to determine if the guessed letter is present in the word that has been set by Player 1. If the guess is incorrect, one element of an ambulance should be drawn onto the game/Turtle screen (see video for example of how elements may be drawn and further detail below).
5.    The process then repeats from Step 3 (i.e. Player 2 is asked to enter another letter, assuming they have not used up their total number of guesses, as below).
6.    Player 2 is allowed a total of 8 incorrect guesses, and hence will lose the game if all 8 attempts have been used.
7.    As consistent with the above, the drawing of the ambulance should take 8 strokes in total to complete on the game/Turtle screen. Therefore, if the picture of the ambulance is fully drawn, this means Player 2 loses the game, and a message is displayed on the screen to confirm.
8.    The game should provide a suitable graphical interface to enhance the users experience and increase the games appeal.