Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

METHODS PROGRAM - Lawn Mowing Invoice Program (Using Methods): Lawn Mowing Invoice Program (Using Methods): This program is for a small lawn mowing service

image text in transcribedimage text in transcribedimage text in transcribed

METHODS PROGRAM - Lawn Mowing Invoice Program (Using Methods): Lawn Mowing Invoice Program (Using Methods): This program is for a small lawn mowing service company called Lisa's Lawn Mowing Service. The lawn mowing season is 20 weeks long in the part of the country Lisa's is located in. This program going to generate invoices for Lisa's customers based on the size of the lawn being mowed, the number of weeks the lawn will be mowed, and how/when payments will be made (there may or may not be a payment service charge). IMPORTANT: Only one lawn mowing invoice is generated at a time. READ ALL THE DIRECTIONS FIRST. STEP 1: Write the Methods you will have in the program in addition to the main method Your program is required to have the following 4 methods in addition to your main method: displayMenu - this must be a void method that accepts no arguments (so it has no parameter variables). It should display the following menu: calc Weekly MowFee- This method will calculate the weekly mowing fee for the lawn (how much is charged each week that the lawn is mowed). O LAWN MOWING INVOICE GENERATOR 1) Calculate and Display Invoice 2) Quit Program For Lisa's the weekly mowing fee for the lawn is calculated as follows: -If the lawn is less than 350 square feet the weekly mowing fee is $20.00 -If the lawn is 350 square feet or more but less than 550 square feet the weekly mowing fee is $30.00 -If the lawn is 550 square feet or more, the weekly mowing fee is $40.00 This must be a method with one parameter (it accepts one argument). This method should NOT be void; it should return the weekly fee for mowing the lawn. The argument passed into the method will be an integer that represents the size of the lawn in square feet. This method should return the weekly mowing fee for the lawn based on the size of lawn in square feet (so if the lawn was 450 square feet the method should return 30). O calcTotal Mow Cost - This method will calculate the total mowing cost for the lawn. This must be a method with two parameters (it accepts two arguments). This method should NOT be void. The first parameter should be the number of weeks the lawn is going to be mowed and the second parameter should be the weekly mowing fee for the lawn. This method should return the total mowing cost for the lawn for all the weeks. Calculate the total mowing cost as follows: total Mowing Cost = weeks lawn is to be mowed* weekly mowing fee calc Service Charge - This method will calculate the payment service fee for the customer if needed. A customer has two payment options: to pay the entire cost in advance or to pay weekly. If a customer pays in advance they will have no service charge, if the customer pays weekly they must pay a weekly service charge of $1.20. This method is used to calculate the weekly charge if the customer chooses to pay weekly (so this method will ONLY be used by main IF the customer chooses to pay weekly). This must be a method with one parameter (it accepts one argument). This method should NOT be void. The argument passed into the method will be the number of weeks the lawn is to be mowed. This method should return the total service charge for the lawn. Calculate the service charge for the lawn as follows: calc Service Charge - This method will calculate the payment service fee for the customer if needed. A customer has two payment options: to pay the entire cost in advance or to pay weekly. If a customer pays in advance they will have no service charge, if the customer pays weekly they must pay a weekly service charge of $1.20. This method is used to calculate the weekly charge if the customer chooses to pay weekly (so this method will ONLY be used by main IF the customer chooses to pay weekly). This must be a method with one parameter (it accepts one argument). This method should NOT be void. The argument passed into the method will be the number of weeks the lawn is to be mowed. This method should return the total service charge for the lawn. Calculate the service charge for the lawn as follows: o total Service Charge = weeks lawn is to be mowed * 1.20 STEP 2: Write the Main Method of your Program that will utilize the methods you wrote in Step 1 Next write the main method of your program. Your main method should have the following variables: one to hold the size of the lawn in square feet, one to hold the number of weeks the lawn is to be mowed, and one to hold whether or not the customer will pay in advance (all at once) or weekly (they should enter 1 if they will pay weekly and 2 if they will pay all in advance). You also need variables to hold the calculated weekly mowing fee, the calculated total 2 mowing cost, the service charge (may or may not be calculated) and the total cost for everything. You should add any additional variables your main method might need (such as a selection variable for the menu and variables for input and formatting). It is up to you to declare the variables correctly (of the correct type). The main method should first call the displayMenu method which displays the Lawn Mowing Invoice Generator menu and asks the user to make a selection. Using either the Scanner class or an input Dialog Box the main method should then accept input from the user and store it into a variable named choice. If the user selects choice 1- the main method should follow these steps to calculate and display an invoice for the customer's lawn service: o The main method should first ask the user for the size of the lawn to be mowed in square feet (square feet will not be fractional). Use an input validation loop to prevent the user from entering a negative number of square feet for the size of the lawn. o Next, the main method should ask the user for the number of weeks they would like the lawn to be mowed for (weeks will not be fractional). You do not have to do input validation for this; assume the user will enter a number bigger than zero and less than 21. and asks the user to make a selection. Using either the Scanner class or an input Dialog Box the main method should then accept input from the user and store it into a variable named choice. If the user selects choice 1- the main method should follow these steps to calculate and display an invoice for the customer's lawn service: o The main method should first ask the user for the size of the lawn to be mowed in square feet (square feet will not be fractional). Use an input validation loop to prevent the user from entering a negative number of square feet for the size of the lawn. o Next, the main method should ask the user for the number of weeks they would like the lawn to be mowed for (weeks will not be fractional). You do not have to do input validation for this; assume the user will enter a number bigger than zero and less than 21. o Next, the main method should next ask the user if payment for the lawn services will be paid in advance (all at once) or on a weekly basis. Have the user enter 1 for payment in advance and 2 for weekly payment. (you do not have to do input validation for this assume the user will enter 1 or 2) o The main method should then calculate the weekly mowing fee for the lawn by calling the calc Weekly MowFee method using the information the user entered for the lawn size. o The main method should then calculate the total mowing cost for all the weeks by calling the calc Total MowCost method and sending the proper information to the method (weekly mowing fee and the number of weeks) o Next if the user entered 2 for weekly payment the main method should call the calcService Charge method to calculate the service charge for the lawn service. If the user entered 1 for payment in advance you can just set the service charge equal to zero (no need to call the method). o Finally the main method should calculate the overall total (total mowing cost + service charge) display the a lawn mowing invoice similar to the one below (do several tests not just the one shown): LISA'S LAWN MOWING SERVICE - INVOICE Size of Lawn: Number of Weeks: Weekly Mowing Fee: Total Mowing Fee: Service Charge: TOTAL COST: 450 10 $30.00 $300.00 $12.00 $312.00 If the user selects choice 2 - the program should end. If the user selects a choice that is not 1 or 2 - the main method should display an "Invalid Selection" message The menu should continue to display and generate lawn mowing invoices until the user selects 2 to quit the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Accounting

Authors: Robert Libby, Patricia Libby, Daniel Short, George Kanaan, M

5th Canadian edition

9781259105692, 978-1259103285

More Books

Students also viewed these Programming questions