Question
In Java please: This program calculates the cost of putting a fence all the way around a rectangular yard AND putting sod everywhere in the
In Java please:
This program calculates the cost of putting a fence all the way around a rectangular yard AND putting sod everywhere in the yard EXCEPT for a circular flower bed. Input consists of the length and width of the yard and the radius of the flower bed (all double and all in feet). The cost of fencing (a constant) is $2.50 per foot and the cost of sod is $1.50 per square foot (another constant). Please review constants do you know how to declare them. Fencing can only be purchased in one foot sections and sod can only be purchased by the square foot. (Remember to use ceil)
Sample input and output:
length 6.2, width 3.4, radius 1.2 Cost of fence is $50.00, cost of sod is $25.50, total cost is $75.50
With length 15.6, width 12.7, radius 3 Cost of fence is $142.50, cost of sod is $255.00, total cost is $397.50
With length 100, width 30, radius 10 Cost of fence is $650.00, cost of sod is $4029.00, total cost is $4679.00
NOTE the formatted output. ALWAYS give two decimal places when you are outputting a dollar amount. I put a pdf in the module called "Strings and Formatting", this shows you how to declare a format. Remember that "##" means at most 2 places, "00" means definitely 2 places.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started