logo Hurry, Grab up to 30% discount on the entire course
Order Now logo
517 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Angel MoralesLaw
(5/5)

984 Answers

Hire Me
expert
Ankhush PandayData mining
(5/5)

574 Answers

Hire Me
expert
Bernard HawkinsMarketing
(5/5)

706 Answers

Hire Me
expert
Neha SharmaaStatistics
(5/5)

1156 Answers

Hire Me
C++ Programming
(5/5)

Your project lead asked you to write a class Farmer for a videogame you are working on. The class should have the following data attributes:

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Object Oriented Programming: Class Farmer

Your project lead asked you to write a class Farmer for a videogame you are working on. The class should have the following data attributes:

Attributes:

_name -- a string

__mood -- an integer value

Methods:

• __init__ -- creates these attributes based on arguments passed into it

• __str__ -- gives all the information on an object.

• get_name -- returns the value of __name of the object

• get_mood -- returns the value of __mood of the object

• set_name -- assigns a value to the __name of the object

• set_mood -- assigns a value to the __name of the object

• talk to -- takes another object of the same class (another_farmer)

• If farmer mood is lower or equal to that of the another_farmer then add 1 to the mood attribute and display a positive message.

• If farmer mood is higher than that of another_farmer, decrease the mood of the farmer by 1 and display a negative message.

• The attributes of another_farmer do not change.

Save your class as farmer_class1.py

Test code: to test your class download this program into the same folder and run it: farmer test code.py

HINT: looking at the test code should help you understand how the class works.

Turn in your farmer_class1.py here.

Start Assignment

 

(5/5)
Attachments:

Expert's Answer

517 Times Downloaded

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme