Subject Code : TPRG2131
Assignment Task

 

You are required to develop two programs and commit your completed programs to your test2 Mercurial repository on the Kallithea server hg.set.durhamcollege.org. There are three categories: state machines, threading, and networking with sockets and JSON formatting. Choose any two categories, and complete one challenge from each category that you choose. In other words, completing only two challenges counts as the complete test.

 

Topic A: State machines If you choose this category, complete only one of the following challenges. The file microwave.py defines a simple state machine for a microwave oven The state machine has two states: IDLE, COOKING • IDLE -- time_entered / start heating --> COOKING • COOKING -- time_out / stop the heating --> IDLE In IDLE, the state machine waits for the user to enter digits then the letter 'S' to Start. Once it starts, it runs for the programmed time (hint: for faster testing, divide machine.cook_time by 10 in the CookingState.enter() method).

1) Low power: Add a check in IdleState.update() that if the 'L' key is entered, the microwave oven will cook at low power. Add a LowPowerState to cycle the on-off at 50% duty cycle (off half of the cooking time). The magnetron that generates microwave radiation in the oven's cooking chamber is strictly an on-off device and cannot be "dialed down". To achieve low power, the oven controller cycles the magnetron off-on during the cooking time. The duty cycle determines the reduction in heat energy delivered. You can simulate the on-off 50% duty cycle with dots and dashes on the output. Instead of printing a line of “…..”, the output would look like “.-.-.-.”.

2) Restart: Add a check in the CookingState.update() that if the 'R' key is pressed, the controller "restarts" the cooking at the full original machine.cook_time.

 

Topic B: Socket programming If you choose this category, complete only one of the following challenges. Each challenge is accompanied by a test client that tries several combinations of test cases. 1) Database lookup: Implement a simple server based on the json_server.py example. The process_transaction() function responds to a JSON query where the key is "question" and the value is the name of a computer architecture. The server looks up the answer and sends back a JSON formatted string. If the key "question" is missing, the function returns {}, in other words an empty dictionary

 

Topic C: Thread programming If you choose this category, complete only one of the following challenges. Each challenge has a starter file. Make a copy of the starter file and rename it. 1) Two threads that start, pause and stop: Develop a program two_threads.py that creates two threads with the same worker function using the threading module. Each thread sends back a message through its own queue when it starts, and again when it finishes. The tread worker pauses for 2 seconds between the start and done messages. The main thread creates a queue for each thread and passes it to the worker function when starting the thread.

 

 

This TPRG2131 - IT Assignment has been solved by our IT experts at UniLearnO. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Eureka! You've stumped our genius minds (for now)! This exciting new question has our experts buzzing with curiosity. We can't wait to craft a fresh solution just for you!

  • Uploaded By : Brett
  • Posted on : March 31st, 2019

Whatsapp Tap to ChatGet instant assistance