0% found this document useful (0 votes)
18 views13 pages

Real Life Project

Computer Proj in JAVA

Uploaded by

Op Subhro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views13 pages

Real Life Project

Computer Proj in JAVA

Uploaded by

Op Subhro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

NAME – SUBHRAJYOTI

DHARA
CLASS – XI
SECTION – SCIENCE
ROLL NO. – 41
SUBJECT - COMPUTER
TOPIC
This project is a console-based fruit shop billing system developed using
core Java. It is designed to simulate a basic billing process in a fruit store
without any graphical user interface (GUI). The system uses simple
arrays, loops following a structured yet minimalistic approach with no use
of advanced data structures or multiple classes. It contains a predefined
catalogue for fruit items, including fresh fruits and their subproducts like
juices, dried packs, and canned varieties. Each item is assigned a unique
product code and categorized accordingly. The program supports features
such as unique bill generation, product listing by name or code, category-
based navigation. This project aims to demonstrate how a complete
billing application can be implemented using only fundamental
programming constructs in Java.
PROJECT REQUIREMENTS

Software Requirements:
 Java Development Kit (JDK) – Version 8 or above

 Java-compatible Text Editor or IDE – e.g., BlueJ, IntelliJ


IDEA, or Eclipse
 Command Line / Terminal – To compile and run the Java
program

Hardware Requirements:
 A basic computer or laptop

 Minimum 2GB RAM

 Operating System: Windows / Linux / macOS (any OS that


supports Java)

Programming Requirements:
 Single Java class using:

o Arrays to store product data (codes, names, prices,


GST, etc.)
o Basic control structures like if, switch, for, while

o Methods for organizing functionalities (billing etc.)


FLOWDIAGRAM
PROGRAM CODE

import java.util.*;
public class FruitShopBillingSystem
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);

// Alphanumeric Product Codes


String productCodes[] =
{
"AF01", "AP02", "BF03", "BC04", "MF05",
"MJ06", "SF07", "SJ08", "OF09", "OJ10",
"GF11", "PF12", "PC13", "WF14", "PF15",
"GF16", "GJ17", "KF18", "MJ19", "DM20"
};

String productNames[] =
{
"Apple Fresh", "Apple Juice", "Banana Fresh", "Banana Chips", "Mango
Fresh",
"Mango Juice", "Strawberry Fresh", "Strawberry Juice", "Orange Fresh",
"Orange Juice",
"Grapes Fresh", "Pineapple Fresh", "Pineapple Canned", "Watermelon
Fresh", "Papaya Fresh",
"Guava Fresh", "Guava Juice", "Kiwi Fresh", "Mixed Fruit Juice", "Dry Fruit
Mix"
};

double productPrices []=


{
150, 80, 40, 120, 100,
90, 200, 95, 60, 85,
90, 70, 110, 30, 45,
50, 70, 180, 100, 250
};

double productGst []=


{
0, 12, 0, 5, 0,
12, 0, 12, 0, 12,
0, 0, 5, 0, 0,
0, 12, 0, 12, 5
};

double productDiscount[] =
{
5, 0, 2, 5, 0,
0, 0, 0, 1, 0,
2, 0, 5, 0, 0,
0, 0, 0, 0, 10
};

int n = productNames.length;

// Cart
int cartProductIndex[] = new int[100];
int cartQuantities[] = new int[100];
int cartSize = 0;

System.out.println("\n Welcome to the Fruit Shop Billing System ");

// Show fruit list once at the top


System.out.println("\n Available Fruit Products:");
System.out.println("Code\tName\t\t\t\tPrice\tGST%\tDiscount%");
for (int i = 0; i < n; i++)
{
System.out.printf("%s\t%-25s\t%.2f\t%.1f\t%.1f\n",
productCodes[i], productNames[i], productPrices[i], productGst[i],
productDiscount[i]);
}
boolean shopping = true;
while (shopping)
{
System.out.print("\nEnter product name or code: ");
String input = sc.nextLine().trim();
int foundIndex = -1;
for (int i = 0; i < n; i++)
{
if (productCodes[i].equalsIgnoreCase(input) ||
productNames[i].equalsIgnoreCase(input))
{
foundIndex = i;
break;
}
}
if (foundIndex != -1)
{
System.out.print("Enter quantity (kg or units): ");
int qty = sc.nextInt();
sc.nextLine(); // consume newline
cartProductIndex[cartSize] = foundIndex;
cartQuantities[cartSize] = qty;
cartSize++;
System.out.println("✅ Added " + productNames[foundIndex] + " x " + qty
+ " to cart.");
} else
{
System.out.println("⚠ Product not found. Please enter a valid code or
name.");
}
System.out.print("Do you want to add more fruits? (yes/no): ");
String choice = sc.nextLine().trim();
if (choice.equalsIgnoreCase("no"))
{
shopping = false;
}
}
// Final bill
System.out.println("\n======= Final Bill =======");
double subtotal = 0, totalGst = 0, totalDiscount = 0;
System.out.println("Code\tProduct\t\t\tQty\tPrice\tTotal");
for (int i = 0; i < cartSize; i++)
{
int index = cartProductIndex[i];
int qty = cartQuantities[i];

double price = productPrices[index];


double total = price * qty;
double gst = total * productGst[index] / 100;
double discount = total * productDiscount[index] / 100;

subtotal += total;
totalGst += gst;
totalDiscount += discount;

System.out.printf("%s\t%-18s\t%d\t%.2f\t%.2f\n",
productCodes[index], productNames[index], qty, price, total);
}
double grandTotal = subtotal + totalGst - totalDiscount;
System.out.println("--------------------------------------------------");
System.out.printf("Subtotal: Rs. %.2f\n", subtotal);
System.out.printf("Total GST: Rs. %.2f\n", totalGst);
System.out.printf("Total Discount: Rs. %.2f\n", totalDiscount);

System.out.printf("Grand Total: Rs. %.2f\n", grandTotal);

System.out.println("==========================================
=========");
System.out.println("Thank you for shopping with us!");
}
}
OUTPUT
CONCLUSION

The Fruit Shop Billing System is a simple yet effective console-based


application designed to streamline the billing process in a fruit shop. By
integrating features such as item selection via product names or codes, GST
and discount calculations, and a final bill generation, the program replicates
a real-life billing experience using basic Java constructs. It enhances the
understanding of arrays, loops, conditional statements, and user input
handling. This project not only simplifies billing operations but also
showcases how core programming logic can be applied to build functional
and user-friendly applications in retail scenarios.
BIBLIOGRAPHY

I have consulted the following sources to complete this project


work:

 BOOKS:

1. ISC APC Understanding Computer Science Class XI

 WEBSITES:

1. www.scribd.com
2. https://www.knowledgehut.com
3. https://github.com

END

You might also like