Skip to content

cs-fullstack-2019-spring/python-classobject-cw-marcus110379

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

python-classObject-cw

Start with a main function and make each problem a function. Call those functions from your main function.

Problem 1:

Create a class Dog. Make sure it has the attributes name, breed, color, gender. Create a function that will print all attributes of the class. Create an object of Dog in your problem1 function and print all of it's attributes.

Problem 2:

We will keep having this problem until EVERYONE gets it right without help

Create a function that has a loop that quits with the equal sign. If the user doesn't enter the equal sign, ask them to input another string.

Problem 3:

In your main file create three Person objects. Change the weight and height of each one. Afterwards, print the BMI (body mass index) of each Person. If you don’t know how to calculate BMI, look at the code I provided for you.

Hint: BMI is (weight / (height * height)) x 703. Weight is in pounds and height is in inches.

Extra:Put the three person objects in an array and use a loop to print out their BMIs.

Problem 4:

Create a class Product that represents a product sold online. A product has a name, price, and quantity.

The class should have changeProduct:

a) If changeProduct has one parameter, it can change the name of the product.

b) If changeProduct has two parameters it can change the name and price of the product.

c) If changeProduct has three parameters it can change the name, price, and quantity of the product.

Create an object of Product in your problem4 function and print all of it's attributes.

Challenge

Use a standard JavaScript template. In your main function create the array below:

var squad = ["Bob", "John", "Bob", "Kenn", "Bob", "Kevin", "John", "Kevin"]; Print how many times each name is present in the array.

About

python-classobject-cw-marcus110379 created by GitHub Classroom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published