Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

Wednesday 16 January 2013

Suppose that electricity costs 4.75 cents per kilowatt hour, and that a surcharge of 10% is added to the bill. A city utility tax is 3% is also levied;however no tax is charged on the surcharge, and no surcharge is added for the tax. A penalty for a late payment is 4% of the total bill. Write the java program that computes an electric bill (by Maria sh)

import java.util.Date;
import java.util.Scanner;

public class ElectricityBill 
{
/*
* 4.75 cents per KiloWatt per hour 
* Surcharge 10%
* City utility tex 3%
* 4% of total bill charged on late payment 
*/
public static void main(String[] args) 
{
int totalUnits;
double billCharged;
Scanner in = new Scanner(System.in);
Scanner ins = new Scanner(System.in);
Date date = new Date();
System.out.print("Enter total units consumed (in KiloWatt) = ");
totalUnits = in.nextInt();
billCharged = totalUnits*4.75;
System.out.println("Day of month = "+date.getDate());
if (date.getDate()> 10)
{
billCharged += billCharged * (0.10+0.04);
}
billCharged += billCharged *(0.03);
System.out.println("Your total bill = "+billCharged);
}

}

Note that 10th of each month is assumed to be the due date of bill payment. If any customer pays bill after due date, 10% surcharge and 4% of total bill on late payment will be charged.
Share