RU beehive logo ITEC dept promo banner
ITEC 120
2012fall
dbraffitt
ibarland

homeinfolectslabsexamshws
tutor/PIsbreeze (snow day)
Object120 + its docsjava.lang docsjava.util docs

lab05a
if-else-if; helper functions
eBay fees

Today (Tue) and Thurs we will complete the lab below. Your goal for today is to (a) understand the problem, (b) complete test-cases for totalEbayFee (and writing a stub function for it), (c) write test-cases for computeFVFee (and writing a stub function for it). Then, on Thursday, you'll finish up by completing the function-bodies for your two functions.

Do not start writing a function body before you have finished test cases for that function! We will not help you with writing function-bodies unless we see several tests for it first.

We will also go through the creation of one test case for totalEbayFee, and computeFVFee (discussing why the percentages are tiered the way they are).

Work on today's lab with a partner. You can write the following two-to-three methods in a class named, say, class EbayExpert.

Calculating eBay fees

If you sell an item on eBay, you are charged a fee. That total, overall fee is comprised of several parts:

Your task: You want to sell a bunch of your old books, DVDs, movies, and video games on eBay, and you'd like a program to calculate how much you'll owe eBay after selling an item in their “fixed price format” (more commonly called “buy it now” — not an auction). Note that fixed price items have to be listed at at least $0.99 (never less).

Write a function totalEbayFee, so that eBay knows how much to charge each seller, when an auction finishes.

  1. What two pieces of information does totalEbayFee need to know, so that it can determine the answer?
  2. What Java data type is the best way to represent these pieces of info?
  3. Write the signature for totalEbayFee, followed by the javadoc comments and some test cases.
  4. Holy Smokes! Computing the overall fee has several parts; the part computing the final value fee is a sizeable task in itself!

    We will break this task into its own sub-function, which totalEbayFee will call as a helper function.

    Make test cases, signature, javadoc, and stub for computeFVFee.

  5. Only after doing the above, write the body of the functions. Note that the test cases help you, to figure out how to compute the answer.
    Hint: You can write the body of totalEBayFee very easily once you can use computeFVFee.
Here is a general skeleton of a solution for this problem.

homeinfolectslabsexamshws
tutor/PIsbreeze (snow day)
Object120 + its docsjava.lang docsjava.util docs


©2012, Ian Barland, Radford University
Last modified 2012.Sep.25 (Tue)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Powered by PLT Scheme