NAME: Tejas Srivastava Class: Xi - A Roll No.: SUBJECT: Computer Project 2019

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

COMPUTER PROJECT -2019

2019

NAME : Tejas Srivastava


CLASS : XI – A
Roll No. :
SUBJECT : Computer Project 2019

T e j a s S r i v a s t a v a ( X I - A ) 1 | 12
COMPUTER PROJECT -2019

ACKNOWLEDGEMENT

In the completion of this project, there were numerous helping hands without
which, I might not have completed it, and whom I want to thank.

First of all, I would like to thank the Almighty for showering His blessings upon all of
us .

Secondly, I would like to thank my Computer teacher, mentor, and guide : Mr. C.K.
Mishra for his ever constant support and guidance throughout the completion of this
project.

Next, I would like to thank my family and friends who also have played a key role in
helping me with their utmost support whenever needed.

Last, but not the least, I would like to thank the reader for contributing his precious
time in reading this project.

PREFACE
T e j a s S r i v a s t a v a ( X I - A ) 2 | 12
COMPUTER PROJECT -2019

This project is completely based on the Programming Topic as given by our


respected S.J.C. Teaching Staff, and in a nutshell, can be said as a program depicting the
monitored Billing and other functions in a Supermarket.

Vivid use of variables with mnemonic names and self-explanatory identifiers have
been used in the source code. The code is well aligned/indented according to the latest
IDE BlueJ 4.2.1 for Java Programming Language. Also, the code is well tried to be made
as compact and logically understandable as possible. Use of numerous Compound
Statements, functions and variables have been made for the ease of the reader.
Moreover, the it has been tried best to make the program graphically interactive on the
Terminal Window itself. Hope you will like it.

import java.util.Scanner;
class Mall
{

T e j a s S r i v a s t a v a ( X I - A ) 3 | 12
COMPUTER PROJECT -2019

static String name,phno;

static int stock[]={500,400,200,144,32,15,1600,900,140,50,


123,43,45,56,67,78,89,90,10,45,
456,231,244,59,1000,98,23,40,87,60};

static int price[]={12,8,400,1200,35999,6000,11,10,13,120,


40,12000,5,45,450,100,100,2999,120,399,
10,60,30,25,12,199,299,129,799,801};

static String
pName[]={"Apple","Bananna","Chair","Door","A.C.","Bed","Chips","Pen","Onion","Pillo
w",

"Paste","Phone","Paper","Light","Mouse","Broom","Bucket","Coat","Bottle","Book",
"Pencil","Fruits","Sugar","Flour","Soap","Gloves","Cap","Tie","Socks","Shirt"};

static int pCode[]={1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,


1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,
1021,1022,1023,1024,1025,1026,1027,1028,1029,1030};

static Scanner sc=new Scanner (System.in);

public static void inputCostumerDetails()


{

System.out.print ("\n\nDear Costumer\nPlease Enter your name : ");


T e j a s S r i v a s t a v a ( X I - A ) 4 | 12
COMPUTER PROJECT -2019

String name1=sc.next();
String name2=sc.nextLine();
name=name1+name2;
System.out.print ("Enter Phone Number : ");
phno=sc.next();
System.out.println("\n");
}

public static void main (String args[])throws InterruptedException


{
do
{
System.out.println ("\f\t\tWELCOME TO BIG BAZAAR!!\n\n");
System.out.println ("Press 1\t-\tModification\nPress 2\t-\tShopping\nPress 3\t-
\tQuit");
int ch=sc.nextInt();
switch(ch)
{
case 2:
inputCostumerDetails();
System.out.print("\f");
boolean exit = false;
double sum=0.0;
int count=0;
int pc[]=new int [30];
int pq[]=new int [30];
String pn[]=new String[30];

T e j a s S r i v a s t a v a ( X I - A ) 5 | 12
COMPUTER PROJECT -2019

int pp[]=new int[30];


do
{
System.out.print ("\f");
System.out.println ("Product Codes Are - 1001, 1002, 1003, ....1030");
System.out.print ("Enter Product Code : \t\t");
int Pc=sc.nextInt();
int y=search(pCode,Pc);
if(y==-1)
{
System.out.print ("Invalid Product Code");
Thread.sleep(1000);
continue;
}
System.out.println("Product Name : \t\t\t"+pName[y]);
System.out.println ("Stock : \t\t\t"+stock[y]);
System.out.println("Rate : \t\t\t\tRs."+price[y]);
System.out.print ("Enter Quantities : \t\t");

int q=sc.nextInt();
if(q>stock[y])
{
System.out.println ("\n\nOUT OF STOCK!!");
Thread.sleep(2000);
continue;
}
stock[y]-=q;
T e j a s S r i v a s t a v a ( X I - A ) 6 | 12
COMPUTER PROJECT -2019

int tot=q*price[y];
System.out.println ("Total : \t\t\tRs."+tot);
sum=sum+tot;
pc[count]=Pc;
pq[count]=q;
pp[count]=price[y];
pn[count]=pName[y];
count++;
System.out.println ("\n\nPress 1 to continue\nPress 2 to exit to Billing");
exit=sc.nextInt()==2;
}while(!exit);

System.out.print ("\f");
System.out.println ("Sl.No.\tProduct\tProduct\tQuantity\tRate\tTOTAL");
System.out.println ("\tCode\tName\t\t\t(in Rs.)(in Rs.)\n");
for(int x=0;x<count;x++)
{

System.out.println((x+1)+".)\t"+pc[x]+"\t"+pn[x]+"\t"+pq[x]+"\t\t"+pp[x]+"\t"+(pp[x]*p
q[x]));
}
System.out.println
("________________________________________________________________");
System.out.println("\nName : "+name);
System.out.println("Phone Number : "+phno);
System.out.println ("\n\n--------------------------------------------------------\nTotal
Amount = Rs."+sum);
T e j a s S r i v a s t a v a ( X I - A ) 7 | 12
COMPUTER PROJECT -2019

System.out.println ("GST Percentage = 18%");


System.out.println ("Discount Applicable = 10%\n----------------------------------
----------------------\n");
System.out.println ("Final AMOUNT =
Rs."+(90/100.0*(118/100.0)*sum));

System.out.println ("Thankyou FOR SHOPPING!!!");


System.out.println ("\n\n\nPress any key to continue");
sc.next();
break;

case 1:
System.out.print ("\fEnter 1 for Stock Modification\nEnter 2 for Rate
Modification\n\n");
int o=sc.nextInt();
exit=false;
switch(o)
{
case 1:
do
{
System.out.println ("\f\t\t\t\tSTOCK MODIFICATION");
System.out.println ("Product Codes Are - 1001, 1002, 1003, ....1030");
System.out.print ("\n\nEnter the Product Code for Modification : ");
int c=sc.nextInt();

int i=search(pCode,c);
if(i==-1)
T e j a s S r i v a s t a v a ( X I - A ) 8 | 12
COMPUTER PROJECT -2019

{
System.out.println("\n\nSorry You Have Entered Wrong Product
Code\nPlease Re-Enter Code Again");
Thread.sleep(3000);

continue;
}
String nm=pName[i];
System.out.println("You Have Chosen Product - "+nm);
System.out.println("Stock - "+stock[i]);
System.out.println("Price - Rs."+price[i]);
System.out.print ("Enter Stock to be Added : ");
int s=sc.nextInt();
stock[i]+=s;
System.out.println ("\nStock UPDATED \n");
{
System.out.println("Product - "+nm);
System.out.println("New Stock - "+stock[i]);
System.out.println("Price - Rs."+price[i]);

}
System.out.println ("\n\nEnter 1 to Modify More stock\nEnter 2 to Exit");
int y=sc.nextInt();
exit=y==2;
}while(!exit);
System.out.println ("\fThankyou................");
break;

T e j a s S r i v a s t a v a ( X I - A ) 9 | 12
COMPUTER PROJECT -2019

case 2:
do
{
System.out.println ("\f\t\t\t\tPRICE MODIFICATION");
System.out.println ("Product Codes Are - 1001, 1002, 1003, ....1030");
System.out.print ("\n\nEnter the Product Code for Modification : ");
int c=sc.nextInt();
int i=search(pCode,c);
if(i==-1)
{
System.out.println("\n\nSorry You Have Entered Wrong Product
Code\nPlease Re-Enter Code Again");
Thread.sleep(3000);

continue;
}
String nm=pName[i];
System.out.println ("You Have Chosen Product - "+nm);
System.out.println("Stock - "+stock[i]);
System.out.println("Price - Rs."+price[i]);
System.out.print ("Enter new Price : ");
int s=sc.nextInt();
price[i]=s;
System.out.println ("\nPrice UPDATED \n");
{
System.out.println("Product - "+nm);

T e j a s S r i v a s t a v a ( X I - A ) 10 | 12
COMPUTER PROJECT -2019

System.out.println("New Stock - "+stock[i]);


System.out.println("Price - Rs."+price[i]);

}
System.out.println ("\n\nEnter 1 to Modofy More Rates\nEnter 2 to Exit");
int y=sc.nextInt();
exit=y==2;
}while(!exit);
System.out.println ("\fThankyou..........");
break;
}
break;

case 3:
System.out.println ("Thankyou......");
Thread.sleep(1000);
System.exit(0);
break;

default:
System.out.println ("Invalid Choice");
break;
}
}while (true);
}

public static int search(int []ar,int i)


T e j a s S r i v a s t a v a ( X I - A ) 11 | 12
COMPUTER PROJECT -2019

{
for(int x=0;x<ar.length;x++)
{
if(ar[x]==i)
return x;
}
return -1;
}
}

T e j a s S r i v a s t a v a ( X I - A ) 12 | 12

You might also like