Hands On

Functions

Step 1

Write a function to take two numbers n and m, and print the sum, product, division (both ways), and the n^m and m^n

Step 2

Write a function that given a monthly savings amount, annual interest rate, and number of years, returns the savings total after that many years. What should the types of each parameter be?

Write another function that asks for the above inputs, and returns them. How?

Overloaded Functions

Starting point: https://repl.it/@JimSkon/PizzaFunction1

Step 1

Given the diameter and costs of two round pizzas determine which is a better buy. You pass the cost and the radius for each.

Step 2

Add the option for rectangular pizzas. You enter the length, width and cost of each.

Step 3

Ask user which type of pizza, and then call correct function.

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2019-10-03 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback