Question: seriously need help....
Write a program that will prompt the user to select an appliance, lookup the energy the appliance uses and for each time of use rate band: calculate the cost to run the appliance and display a bar graph for the cost of running the appliance. The appliance will run for ½ hour each day for 30 days.
Your program will be divided into four separate sub-programs defined as methods below. Use the methods appropriately in your program.
Use each of the following Java statements at least once in your program: switch, while, for, if
Time of Use Rate Comparison Choose an appliance: 1. Dishwasher 2. Clothes Dryer 3. Hair Dryer
Enter your selection: 3 Mid-Peak Cost ====== $ 12.15 Off-Peak Cost === $ 7.65 On-Peak Cost ======= $ 14.85
Synopsis If you have a Smart Meter installed, your hydro utility has the option of charging different rates throughout the day. These rates are divided into three separate bands known as off-peak, mid-peak and on-peak.
Rate Bands and Time of Use Rates
Step #1 Define a method to read an appliance selection. This method will prompt the user to select one of the above appliances, if the selection is not valid then ask the user to try again.
Return Value: - a number representing the selected appliance
Define a method to return the energy for an appliance. Parameters:
a number representing the appliance Return Value:
return the kWh for the selected appliance Step #3
Define a method for calculating the cost of using an appliance. Use the rate for the selected rate band given in the rate band table above.
Cost = Time of use rate x energy x hours
energy the appliance uses in kWh
number of hours the appliance runs for 30 days
rate band (ie. 1 for on-peak, 2 for mid-peak, 3 for off-peak)
Define a method for printing a single bar of a horizontal bar graph. The bar header text will be based on the rate band and display one of ?Mid-Peak Cost?, ?Off-Peak Cost?, ?On-Peak Cost?.
The width of the bar header text will be 15 characters.
Print the bar graph using the = character, scale the width to ½ the cost.
Print the cost at the end of the bar. Example On-Peak Cost ==== $25.36 Parameters - rate band - cost