To whom it may concern, I need someone to help me to develop programs for the
following assignments. I have been working on these assignments for a week and
a half, and I can't make any progress. I also been dealing with a sick
relative, so please help me out immediately. I use the version 3.4.1. Here are
the following assignments and what I have so far:
1. Define a new kind of Turtle, TurtleGTX, that comes with some extra features:
it can jump forward a given distance, and it has an odometer that keeps track
of how far the turtle has travelled since it came off the production line. (The
parent class has a number of synonyms like fd, forward, back, backward, and bk:
for this exercise, just focus on putting this functionality into the forward
method.) Think carefully about how to count the distance if the turtle is asked
to move forward by a negative amount. (We would not want to buy a second-hand
turtle whose odometer reading was faked because its previous owner drove it
backwards around the block too often. Try this in a car near you, and see if
the car’s odometer counts up or down when you reverse.)
import turtle
class turtle_Turtle():
ts = turtle.Screen()
ts.title("TurtleGTX")
bob = turtle.Turtle()
bob.shape("turtle")
bob.color("brown")
class TurtleGTX(turtle_Turtle):
odometer = 0
def forward(x):
if (x >= 0):
i = 0
while (i < x):
self.fd()
odometer += 1
i+=1
else:
i = 0
while (i > x):
self.bk()
odometer +=1
i-=1
print ("Odometer is", odemeter)
my_turtle = TurtleGTX()
my_turtle.foward()
2. You are to develop a program (name it trivia_game.py) that will play a
trivia game with two players. The game will be played this way:
Starting with player 1, each player gets a turn at answering 5 trivia
questions. When a question is displayed, 4 possible answers are also displayed
(1 of the 4 is the correct answer). A correct answer earns the player 1 point.
After both players have answered their 5 questions the program will display the
number of points earned by each player and declare the player with the most
points the winner (or a tie if both players have earned the same number of
points).
You must write a class (name it Question.py) to hold the data for a trivia
question. The class should have the following attributes:
A trivia question
Possible answer 1
Possible answer 2
Possible answer 3
Possible answer 4
The number of the correct answer (1, 2, 3, or 4)
The Question class should have an appropriate __init__ method, accessors and
mutators.
Your program should have a list or dictionary containing 10 Question objects,
one for each trivia question. You are to make up your own trivia questions.
Submit both files (zip the two files if possible).
trivia_game.py
import sys
import random
import Question.py
questions = [
Question("How many states start with the letter M", 3, ["6", "7", "8",
"9"]),
Question("What is the area of a right triagle with a hypotenuse of 10 and
an altitude of 8", 1, ["24", "40", "48", "80"]),
Question("Which physics quantity is not a vector", 4, ["Acceleration",
"Momentum", "Torque", "Work"]),
Question("How many inches are in a foot", 2, ["6", "12", "18", "24"]),
Question("Who does not play in the NFL anymore", 3, ["Frank Gore", "Richard
Sherman", "Peyton Manning", "Antonio Gates"]),
Question("What is a bakers dozen equivalent to", 4, ["10", "11", "12",
"13"]),
Question("Which city has a NBA team", 1, ["Sacramento", "Baltimore", "St.
Louis", "Pittsburgh"]),
Question("Which of the following elements have eleven protons", 4,
["boron", "sulfur", "floruine", "sodium"]),
Question("What is the minimum age to run for president of the United
States", 2, ["30", "35", "40", "45"]),
Question("Who won super bowl 44", 1, ["New Orleans Saints", "Pittsburgh
Steelers", "Minnesota Vikings", "Indianapolis Colts"])
]
random.shuffle(questions) # Randomize the order of the questions
for question in questions:
question.ask()
Question.py
3. Our final exam is a real world problem about efficiency in a warehouse.
XYZ Corporation sells products online. The company has a large warehouse in
which it stores its inventory of products. Orders are picked, packed and
shipped from the warehouse.
XYZ Corporation has contracted with you to write a program that will minimize
the number of steps that the staff in the warehouse (called ODA's) take in
picking the products ordered by customers.
The information you will need to complete this assignment are in the following
files:
Specifications: CTIM285_Summer_2016_FinalExam.pdf
Warehouse Map: WarehouseImage.pdf
Data for Analysis: warehouse_data_final_exam_Python.txt
Data for Analysis is saved in this order on each line of the file:
[orderNumber, partNumber, quantyNumber, aisleNumber, shelfNumber, binNumber]
infile = open("warehouse_data.txt", "r")
for x in infile
for j in range(3, 6):
if (j == 1):
temp=a[0:3]
a[0:3]=a[3:]
a[3:]=temp
Thanks,
Justin
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor