Using Java. Now follow the instructions below to create a new program named GarysGrassPros: Open Eclipse. Create a New -> Java project. Name it GarysGrassPros and click Finish and OK. Next, create a New -> Class. Name it GarysGrassPros and be sure to check the first checkbox under "Which method stubs would you like to create?" and click Finish. Delete the green comment text in the file "GarysGrassPros.java" Add a comment at the top // (your name) Add another comment at the top // Project 5 Add code to the program file "GarysGrassPros .java" use several methods to facilitate pricing of jobs for a landscaping company. The methods should be coded as follows: method main(): has its usual method heading and its code will display the following messsages and logic: Welcome to GarysGrassPros... we will get your yard looking beautiful this spring!! We have the best grass growing, lawn cutting, and mulching plans for you. What are you interested in getting pricing for? Enter 'g' for grass growing, 'c' for lawn cutting, or 'm' for mulching: *method main should use an if-else-if statement to call one of three methods: grassGrowing(), lawnCutting() or mulching() based on the user input. When it gets data back from a method, it should print an appropriate message: The pricing for your (plan) job is: $(value) method grassGrowing(): Takes in no data. It asks the user to enter the size of their lawn (1=quarterAcre, 2=halfAcre, 3=threeQuarterAcre, 4=fullAcre). Based on the user input, it determines the price per fertilizer grass growing treament and returns this value back as a double. Pricing is as follows: quarterAcre yard = $50, halfAcre yard = $75, threeQuarterAcre yard = $100, and fullAcre yard = $120 method lawnCutting(): Takes in no data. It asks the user to enter the size of their lawn (1=quarterAcre, 2=halfAcre, 3=threeQuarterAcre, 4=fullAcre). Based on the user input, it determines the price per lawn cut and returns this value back as a double. Pricing is as follows: quarterAcre yard = $30, halfAcre yard = $50, threeQuarterAcre yard = $70, and fullAcre = $90 method mulching(): Takes in no data. It asks the user to enter the square footage of the area they would like mulched (between 450 -1800 sq ft). Based on the user input, it calculates the number of cubic yards of mulch needed to mulch the area, assume 1 cubic yard will mulch 150.0 sqft. Round up or down as needed because partial cubic yards cannot be ordered. Once the number of cubic yards is determined, this method should ask the user what type of mulch they want (1=hemlock, 2=bark, 3=pine). Based on the user input, it computes the price of the mulch order and returns this value back as a double. Pricing is as follows: hemlock = $45/cubic yard, bark = $40/cubic yard, pine = $30 cubic yard *Requirement: Use one Scanner object for all your methods, define this above the main method: final static Scanner scan = new Scanner(System.in); *note this is only to be used for constants, not variables. (CHECK PHOTO ATTACHED FOR CLEAR PHOTO OF INSTRUCTIONS)
Using Java.
Now follow the instructions below to create a new program named GarysGrassPros:
-
-
- Open Eclipse.
- Create a New -> Java project. Name it GarysGrassPros and click Finish and OK.
- Next, create a New -> Class. Name it GarysGrassPros and be sure to check the first checkbox under "Which method stubs would you like to create?" and click Finish.
- Delete the green comment text in the file "GarysGrassPros.java"
- Add a comment at the top // (your name)
- Add another comment at the top // Project 5
- Add code to the program file "GarysGrassPros .java" use several methods to facilitate pricing of jobs for a landscaping company. The methods should be coded as follows:
-
-
-
- method main(): has its usual method heading and its code will display the following messsages and logic:
-
Welcome to GarysGrassPros... we will get your yard looking beautiful this spring!!
We have the best grass growing, lawn cutting, and mulching plans for you.
What are you interested in getting pricing for? Enter 'g' for grass growing, 'c' for lawn cutting, or 'm' for mulching:
*method main should use an if-else-if statement to call one of three methods: grassGrowing(), lawnCutting() or mulching() based on the user input. When it gets data back from a method, it should print an appropriate message:
The pricing for your (plan) job is: $(value)
-
-
- method grassGrowing(): Takes in no data. It asks the user to enter the size of their lawn (1=quarterAcre, 2=halfAcre, 3=threeQuarterAcre, 4=fullAcre). Based on the user input, it determines the price per fertilizer grass growing treament and returns this value back as a double.
-
- Pricing is as follows: quarterAcre yard = $50, halfAcre yard = $75, threeQuarterAcre yard = $100, and fullAcre yard = $120
-
- method grassGrowing(): Takes in no data. It asks the user to enter the size of their lawn (1=quarterAcre, 2=halfAcre, 3=threeQuarterAcre, 4=fullAcre). Based on the user input, it determines the price per fertilizer grass growing treament and returns this value back as a double.
-
-
-
- method lawnCutting(): Takes in no data. It asks the user to enter the size of their lawn (1=quarterAcre, 2=halfAcre, 3=threeQuarterAcre, 4=fullAcre). Based on the user input, it determines the price per lawn cut and returns this value back as a double.
-
- Pricing is as follows: quarterAcre yard = $30, halfAcre yard = $50, threeQuarterAcre yard = $70, and fullAcre = $90
-
- method lawnCutting(): Takes in no data. It asks the user to enter the size of their lawn (1=quarterAcre, 2=halfAcre, 3=threeQuarterAcre, 4=fullAcre). Based on the user input, it determines the price per lawn cut and returns this value back as a double.
-
-
-
- method mulching(): Takes in no data. It asks the user to enter the square footage of the area they would like mulched (between 450 -1800 sq ft). Based on the user input, it calculates the number of cubic yards of mulch needed to mulch the area, assume 1 cubic yard will mulch 150.0 sqft. Round up or down as needed because partial cubic yards cannot be ordered. Once the number of cubic yards is determined, this method should ask the user what type of mulch they want (1=hemlock, 2=bark, 3=pine). Based on the user input, it computes the price of the mulch order and returns this value back as a double.
-
- Pricing is as follows: hemlock = $45/cubic yard, bark = $40/cubic yard, pine = $30 cubic yard
-
- method mulching(): Takes in no data. It asks the user to enter the square footage of the area they would like mulched (between 450 -1800 sq ft). Based on the user input, it calculates the number of cubic yards of mulch needed to mulch the area, assume 1 cubic yard will mulch 150.0 sqft. Round up or down as needed because partial cubic yards cannot be ordered. Once the number of cubic yards is determined, this method should ask the user what type of mulch they want (1=hemlock, 2=bark, 3=pine). Based on the user input, it computes the price of the mulch order and returns this value back as a double.
-
(CHECK PHOTO ATTACHED FOR CLEAR PHOTO OF INSTRUCTIONS)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images