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.

Thursday 12 April 2012

How to use If else in switch statement in java to perform different arithmatic operations BY (Shifa Anjum)

import java.util.Scanner;


public class ConditionalSwitch {
   
    public static void main(String[] args) {
       
        Scanner in = new Scanner (System.in);
        int a,b,c=1;
       
        System.out.println("First number must be 1 to 5 and second from 1 to 100");
       
        System.out.print("Enter first number = ");
        a=in.nextInt();
        System.out.print("Enter second number = ");
        b=in.nextInt();
       
        switch(a)
        {
        case 1:
            if (b<100 && b>1)
            {
                c = a * b;
                System.out.println("Product of both numbers = "+c);
            }
            else
                System.out.println("Second number must be from 1 to 100");
            break;
        case 2:
            if (b<100 && b>1)
            {
                c = a + b;
                System.out.println("Sum of both numbers = "+c);
            }
            else
                System.out.println("Second number must be from 1 to 100");
            break;
        case 3:
            if (b<100 && b>1)
            {
                c = a - b;
                System.out.println(""+a+" - "+b+" = "+c);
            }
            else
                System.out.println("Second number must be from 1 to 100");
            break;
        case 4:
            if (b<100 && b>1)
            {
                c = a / b;
                System.out.println(""+a+" / "+b+" = "+c);
            }
            else
                System.out.println("Second number must be from 1 to 100");
            break;
        case 5:
            if (b<100 && b>1)
            {
                c = b % a;
                System.out.println("Remainder of "+b+" / "+a+" = "+c);
            }
            else
                System.out.println("Second number must be from 1 to 100");
            break;
        default:
                System.out.println("First number must be from 1 to 5");
        }
    }

}

Monday 14 November 2011

Java program that calculates table of any given number and displays in ascending or descending order (by Sara)

import java.util.*;

class table
{
public static void main (String argsp[])
{
Scanner in = new Scanner (System.in);

int a,b,c,d=0;
System.out.print ("\n\t Enter the number to print table = ");
a=in.nextInt();
System.out.print ("\n\t Enter 1 for ascending and 2 for descending order = ");
c=in.nextInt();

if (c==1)
{
System.out.println ("\n\t Table of "+a+" in ascending order ");
b=1;
while (b<=10)
{
d=b*a;
System.out.println ("\n\t "+a+" * "+b+" = "+d);
++b;
}
}
else if (c==2)
{
System.out.println ("\n\t Table of "+a+" in ascending order ");
b=10;
while (b>0)
{
d=b*a;
System.out.println ("\n\t "+a+" * "+b+" = "+d);
--b;
}
}
else
System.out.println ("\n\t Invalid number ");

}
}

Saturday 5 November 2011

Develop a java program to generate the Electricity bill. The program have three member functions, Getdata(): to accept the block number, flat name, name and number of units, Calc(): calculate the total cost, Display(): display the bill in proper format ( name, units , total charges). If the total is greater than RM 150 then additional surcharge 15% is added (by Fikri Fieda)


import java.util.*;
class ebill
{
public static void main (String args[])
{
customerdata ob = new customerdata();
ob.Getdata();
ob.Calc();
ob.Display();

}
}

class customerdata
{
Scanner in = new Scanner (System.in);
Scanner ins = new Scanner (System.in);
String cname,fname;
int bn;
double units,tbill;

void Getdata()
{
System.out.print ("\n\t Enter block number = ");
bn = in.nextInt();
System.out.print ("\n\t Enter flate name = ");
fname = ins.nextLine();
System.out.print ("\n\t Enter customer name = ");
cname = ins.nextLine();
System.out.print ("\n\t Enter total consumed units = ");
units = in.nextDouble();
}

void Calc()
{
if (units<100)
tbill=0.40*units;
else if (units>100 && units<300)
tbill=0.50*units;
else
tbill=0.60*units;
if (tbill>150)
tbill+=tbill*0.15;
}

void Display()
{
System.out.println ("\n\t Customer name = "+cname);
System.out.println ("\n\t Total units = "+units);
System.out.println ("\n\t Total bill = RM "+tbill);
}
}

Share