Simpler Method exercises with input parameters, return values
and test cases:
profitOnOneSale
Input parameters: |
||
|
Double |
Price |
|
Double |
Cost |
Description of processing: The profit is the price minus the cost. |
||
Return: |
||
|
Double |
Profit |
Step II - code your main method to use this new method you created:
. profitOnManySales
Input parameters: |
||
|
Double |
Price |
|
Double |
Cost |
|
Int |
Quantity sold |
Description of processing: The profit is the price minus the cost. Multiply that times the quantity sold for the total profit. |
||
Return: |
||
|
Double |
Profit |
Step IV: Change your main method to print a price on many sales
Step V: Change your main method to ask for the quantity: