QuestionQuestion

Translate the following steps into a Java program. These steps describe how to compute the electricity bill.
1. Get the normal rate per liter and save it in rate
2. Get the amount of water consumed and save it in qConsumed
3. Get the maximum consumption without being charged extra and save it in qMax
4. Get the extra percentage to be charged when the consumption is more than qMax and save it in percentage
5. If qConsumed less than or equal to qMax then
i) Compute the bill as rate * qConsumed
ii) Display “You are not charged extra”
6. Otherwise
i) Compute the bill as (rate +rate*percentage) *qConsumed
ii) Display “You are charged extra”
7. Add 5% taxes to the bill
8. Display the bill

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.Scanner;


/**
*
* @author
*/
public class Solution {

    public static void main(String[] args) {
       Scanner console = new Scanner(System.in);
       double rate;
       double bill;
       // 1. Get the normal rate per liter and save it in rate
       System.out.println("Enter the normal rate per liter");
       rate = console.nextDouble();
      
       // 2. Get the amount of water consumed and save it in qConsumed
       System.out.println("The amount of water consumed");
       double qConsumed...

By purchasing this solution you'll be able to access the following files:
Solution.java.

$4.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats