ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 05 May 2017 My Price 9.00

CSCA48 Exercise 2

Exercise 1 is banana game. Please help me solve the exercise 2.

 

 

CSCA48 Exercise 2
Due: January 27, 2017. 5:00pm
Last week, we had you play the banana game. Several of you came to us and asked us how we were going
to mark it. Well, rather than just tell you, we thought we’d show you. Or rather, we thought we’d let you
show us. Your job this week is going to be to write a function that verifies solutions for the banana game.
The interesting thing is that we’ll be able to do it for any type of container without a lot of extra work
(thanks to the power of ADTs). banana verify
Write a function called banana verify, that takes 4 parameters:
• A source word (str)
• A goal word (str)
• A container (Container)
• A list of moves (list of str)
The source and goal words are the source and goal words for the banana game. The list of moves is a list of
moves, with M meaning move, P meaning put, and G meaning get. So the CAT example from the exercise 2
handout would have the moves list:
['P', 'M', 'G', 'M']
A Container is an ADT that has four methods: put(item) adds an item to the container1 , get() removes
and returns the next item in the container, peek() returns the value of the next item that will be returned
by get but doesn’t actually modify the container2 , and is empty() returns True iff the container is empty.
You won’t know how the container object is implemented, and you shouldn’t care. It could be a stack, or
a queue, or a bucket, or something else entirely. Your job is to test whether the moves in the moves list,
preformed using the specified container will turn the source word into the goal word, in which case, your
function will return True. Otherwise it should return False.
Your code must start with the line:
from container import *
we will provide the container class (you’ll probably want to write your own for testing purposes), as well as
the necessary exception classes. 1 if
2 if the container is full, as with a bucket, put will raise a ContainerFullException
the container is empty, get and peek will raise a ContainerEmptyException 1

Attachments:

Answers

(11)
Status NEW Posted 05 May 2017 12:05 AM My Price 9.00

-----------

Attachments

file 1493943114-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)