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

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  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.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

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