CPSC 120B: Programming Project #1
Yard Work
Due Friday, September 20, 2002 by 4 p.m.
A small time landscape supply company specializes in providing
home delivery of landscape supplies to customers. The company
wants you to write a program
to help customers estimate their needs for landscaping supplies and
to estimate the cost to the customer of home delivery. The
company only supplies three items: mulch, which is sold in scoops;
fertilizer, which is sold in 40 pound bags; and grass seed, which
is sold in 20 pound bags. The program will assume that the user will
need to fertilize and overseed a rectangular lawn and will need to
mulch a circular area around each of several trees and bushes.
The owners of the company want your program to compute and print
out the following:
- the amount of mulch needed both in terms of cubic yards and in the
number of scoops (this will be a whole number),
- the amount of fertilizer needed both in terms of pounds and
the number of 40 pound bags (this will be a whole number),
- the amount of grass seed needed both in terms of pounds and
the number of 20 pound bags (this will be a whole number),
- the cost of buying each of the above items from the company
- the total cost of buying the supplies from the company and
having them delivered.
Your program should read in the following information from the user:
- The name of the customer
- The dimensions of the lawn -- length and width in feet.
- The number of trees and bushes that need mulch.
- The radius (in feet) of mulch around the trees and bushes.
Use the following assumptions in your calculations:
- The amount of fertilizer needed is one pound per 1000 square feet.
- The amount of seed needed is three pounds per 1000 square feet.
- Fertilizer is sold in 40 pound bags.
- Grass seed is sold in 20 pound bags.
- A two inch layer of mulch should be applied to the area mulched.
- Mulch is sold in "scoops" -- a scoop is 1.25 cubic yards of mulch.
- The price of a 40 pound bag of fertilizer is $8.95.
- The price of a 20 pound bag of grass seed is $33.99.
- The price of a scoop of mulch is $18.00.
- The delivery charge is $15.00.
The program should print out a report nicely formatted (with
some sort of border, blank lines in appropriate places,
and dollars and cents correctly formatted) with all of
the above information (including the customer's name).
Sample output will be posted on the course Web site.
Your output does not need to be formatted exactly the same but
it must contain all the information AND must look good (and be
free of spelling errors!!!)
Requirements:
- You must use meaningful names for variables, constants, and
your class. Use Java conventions for case -- constants (declared
with final) are all uppercase (with the underscore separating words),
variables start with a lowercase letter (but each separate word
within the variable starts with a capital), the class name is
capitalized.
Choosing meaningful names makes your program easier to read and follow.
- You must use constant identifiers rather than literals
for the constants in the program (there are quite a few including some
needed for conversion of feet to yards!).
- Use white space (blank lines and blank spaces) in your program to make
it easier to read. Separate the sections of the program with blank lines.
Indent and align your code properly (emacs helps you do this - it automatically
indents in most cases -- if a line isn't indented correctly go to it
and press TAB -- if TAB doesn't make it indent correctly you probably have
a syntax error).
- Document your program. At the top you must have documentation that
includes the complete pathname of the file, a brief description of
what the program does (this should include a list of the input expected
and the output the program will produce), the date, and your name.
- Hand IN: A printed copy of your program
- Tar the .class and .java files and email the .tgz file
to ingram@roanoke.edu with a subject of cpsc120 project1.
Academic Integrity Reminder!!! Programming
assignments are to be your own work. You may get help on the specifics
of the assignment from no one except the instructor. You may not show
your program to anyone or look at anyone else's program or share ideas
with anyone about how to write the program.