0% found this document useful (0 votes)
7 views19 pages

Bill Payment Programs in Java

The document contains multiple Java programs for calculating various utility bills including electricity, water, gas, mobile, and internet. It also includes features like menu-driven bill payment, discounts, late fees, and online payment simulation. Each program demonstrates different programming concepts such as conditionals, classes, and methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views19 pages

Bill Payment Programs in Java

The document contains multiple Java programs for calculating various utility bills including electricity, water, gas, mobile, and internet. It also includes features like menu-driven bill payment, discounts, late fees, and online payment simulation. Each program demonstrates different programming concepts such as conditionals, classes, and methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Simple Electricity Bill Program


(Basic Java)
import [Link];
class ElectricityBill {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
[Link]("Enter units: ");
int units = [Link]();
double bill = units * 3;
[Link]("Electricity
Bill = ₹" + bill);
}
}
[Link] bill using if- else
import [Link];
class ElectricityBillIf {
public static void main(String[] args) {
Scanner sc = new
Scanner([Link]);
int units = [Link]();
double bill;
if (units <= 100)
bill = units * 1.5;
else
bill = 100 * 1.5 + (units - 100) *
2.5;
[Link]("Bill = ₹" + bill);
}
}

3. Water bill calculation


import [Link];
class WaterBill {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
int liters = [Link]();
[Link]("Water Bill =
₹" + (liters * 0.05));
}
}
4. Gas Bill Program
import [Link];
class GasBill {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
int cylinders = [Link]();
[Link]("Gas Bill =
₹" + (cylinders * 900));
}
}
5. Mobile bill Payment
import [Link];
class GasBill {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
int cylinders = [Link]();
[Link]("Gas Bill = ₹"
+ (cylinders * 900));
}
}
6. Internet Bill Program

import [Link];
class InternetBill {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
int gb = [Link]();
[Link]("Internet
Bill = ₹" + (gb * 40));
}
}
[Link]- Driven Bill- Payment
import [Link];
class MenuBill {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("[Link]
[Link] [Link]");
int ch = [Link]();
switch (ch) {
case 1: [Link]("₹300");
break;
case 2: [Link]("₹150");
break;
case 3: [Link]("₹500");
break;
default: [Link]("Invalid");
}
}
}
[Link] Payment Using Constructer
class Bill {
Bill(int amt) {
[Link]("Bill
Amount = ₹" + amt);
}
}
class Main {
public static void main(String[]
args) {
new Bill(750);
}
}
[Link] Payment Using Class and
Object

class Bill {
int amount = 500;
void pay() {
[Link]("Bill Paid:
₹" + amount);
}
}
class BillPayment {
public static void main(String[]
args) {
Bill b = new Bill();
[Link]();
}
10. Bill Payment With Customer
Details
import [Link];
class CustomerBill {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
String name = [Link]();
int units = [Link]();
[Link](name + "'s
Bill = ₹" + (units * 3));
}
}
11.
11 . Discount on Bill Payment
import [Link];
class DiscountBill {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
double bill = [Link]();
if (bill > 1000)
bill - = bill * 0.1;
[Link]("Final Bill = ₹"
+ bill);
}
}
12. Late fee Bill Calculation
import [Link];
class LateFee {
public static void main(String[]
args) {
Scanner sc = new
Scanner([Link]);
double bill = [Link]();
int days = [Link]();
[Link]("Total = ₹"
+ (bill + days * 10));
}
}
13. Online Bill Payment Bill
Payment Simulation
import [Link];
class OnlinePayment {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
int pin = [Link]();
if (pin == 1234)
[Link]("Payment
Successful");
else
[Link]("Payment
Failed");
}
}
14. Bill Payment Using Method
class BillMethod {
static void pay(int amt) {
[Link]("Paid ₹"
+ amt);
}
public static void
main(String[] args) {
pay(600);
}
}
[Link] Monthly Bill Program
class TotalBill {
public static void
main(String[] args) {
int electricity = 300;
int water = 150;
int mobile = 500;
[Link]("Total
Bill = ₹" + (electricity + water
+ mobile));
}
}

You might also like