Write appropriate accessor and mutator methods

Assignment Help Python Programming
Reference no: EM131717504

Assignment

Problem 1: Car Class

1. Write a class named Car that has the following data attributes:

o __year_model (for the car's year model)

o __make (for the make of the car)

o __speed (for the car's current speed)

o The Car class should have an __init__ method that accepts the car's year model and make as arguments. These values should be assigned to the object's __year_model and __make data attributes. It should also assign 0 to the __speed data attribute.

The class should also have the following methods:

o accelerate

The accelerate method should add 5 to the speed data attribute each time it is called.

o brake

The brake method should subtract 5 from the speed data attribute each time it is called.

o get_speed

The get_speed method should return the current speed.

o Next, design a program that creates a Car object and then calls the accelerate method five times. After each call to the accelerate method, get the current speed of the car and display it. Then call the brakemethod five times. After each call to the brake method, get the current speed of the car and display it.

Problem 2: Personal InformationClass

1. Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods. Also, write a program that creates three instances of the class. One instance should hold your information, and the other two should hold your friends' or family members' information.

Reference no: EM131717504

Questions Cloud

How the animals raised for food are treated : Assess how technology has changed how we view food, as well as how we treat each other and the environment.
What are budgeted cash collections for july : The August 31 accounts receivable is budgeted to be $108,000. What are budgeted cash collections for July
Determine significant leverage-adjusted duration gap : Suppose that a thrift institution has an average asset duration of 2.5 years and an average liability duration of 3.0 years.
Prepare a budgeted income statement for september : Varmit-B-Gone is a pest control service that operates in a suburban neighborhood. Prepare a budgeted income statement for September
Write appropriate accessor and mutator methods : Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods.
Find ratio of total assets to equity capital : Suppose a stockholder-owned thrift institution is projected to achieve a 1.25 per-cent ROA during the coming year.
Write a paper characterizing the trade of the us : Description of the most important traded products and the evolution of trade between these two economies.
Blood vessel and enter the surrounding tissue cells : What's the driving power for the oxygen to move from blood vessel and enter the surrounding tissue cells? Describe the process
Amino group in the r group exists in the acid : Explain why acidic amino acids are called acidic, even though the carboxyl group in the R group exists in the conjugate base form.

Reviews

Write a Review

Python Programming Questions & Answers

  Turn the turtle image into a .gif picture

How can you turn the turtle image into a .gif picture when using the built-in turtle for Python? If that's impossible how do you remove the line when you move the turtle around?

  Write a program that asks for the user age

Write a program that asks for the user's age. Based on their response print "You can vote" (18 years old or older) or "You can't vote" and also whether or not he/she is a senior citizen (over 64)

  Determines number of occurrences of a given letter in string

In this last checkpoint, you will write a new program that determines the number of occurrences of a given letter in a string. To do so, you are only allowed to use the replace() and len() functions.

  Write a function that will take two arguments

Write a function that will take two arguments: a word to be searched for and a list of strings containing the grid and write code to read, in turn, each line of the file, remove the newline character and append the resulting string to a list of stri..

  Write programs that read a sequence of integer inputs

Write programs that read a sequence of integer inputs and print The smallest and largest of the inputs. The number of even and odd inputs.

  Write a program that will input the name of five students

Write clearly with documentations where necessary as you write the program to solve the following problem.

  How a vertical scroll bar is associated with a list box

What are instance variables, and what role does the name ‘self' play in the context of a class definition. Describe how a vertical scroll bar is associated with a list box.

  Website to inform about aspect of the local environment

ICT112 Assignment - write a Python program that generates a small web site to inform Sunshine Coast people about some aspect of the local environment or a local sustainability issue.

  Whatever is done in excel you have to do it in python

Whatever is done in excel you have to do it in python. Like you have to categorize the tweets related to app and other. It should be done by using pandas

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Can you improve the algorithm from the given problem

Devise an experiment to verify that the list index operator is O(1) . Can you improve the algorithm from the previous problem to be linear? Explain.

  Implements the binary tree as a class

Implements the binary tree above as a class. Divides into tokens, generating an iterator, with added support for variable names. Evaluates a postfix expression, given an iterator, with added support for variables.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd