Beruflich Dokumente
Kultur Dokumente
GROCERY SHOP
1
INDEX
1 Introduction 2
2 Documentation
3
3 Source Code 6
4 Output Screenshots 35
5 Acknowledgement 40
2
INTRODUCTION
If else
While loop
Do while loop
For loop
Arrays
Parameterized constructor
3
DOCUMENTATION
Class ComputerProject
java.lang.Object
ComputerProject
Field Summary
Fields
Modifier and Type Field and Description
(package private) static costprice
double[]
(package private) static count
int
(package private) static i
int
(package private) static name
java.lang.String[]
(package private) static quantity
int[]
(package private) static subname
java.lang.String[]
(package private) static sum
double
4
Constructor Summary
Constructors
Constructor and Description
ComputerProject()
Method Summary
Field Detail
5
if(((login[0].compareTo(login1)==0)||(login[1].compareTo(log
in1)==0)||(login[2].compareTo(login1)==0))&&((password[0]
.compareTo(password1)==0))||((password[1].compareTo(pas
sword1)==0))||((password[2].compareTo(password1)==0)))
{
success=true;
System.out.println(" WELCOME TO
ALL IN ONE GROCERY STORE");
9
System.out.println("");
System.out.println("**********************************
***************************************************
***************************************************
************************");
obj.menu();
}
else
{
System.out.println("YOU HAVE ENTERED THE WRONG
ID AND/OR THE WRONG PASSWORD. PLEASE TRY
AGAIN");
}
}while (success==false);
}
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
-----------------------------------------------------------------");
System.out.println();
System.out.println(" MAIN
MENU");
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
----------------------------------------------------");
System.out.println();
System.out.println();
System.out.println("1.CHOCOLATES");
System.out.println("2.FRUITS");
System.out.println("3.VEGETABLES");
System.out.println("4.DAIRY PRODUCTS");
System.out.println("5.BILL");
System.out.println("6.EXIT");
System.out.println();
System.out.println();
System.out.println("Enter your choice");
11
n=sc.nextInt();
if(n==1)
obj.chocolates();
if(n==2)
obj.fruits();
if(n==3)
obj.vegetables();
if(n==4)
obj.dairyproducts();
if(n==5)
obj.bill();
if(n==6)
{
System.out.println();
System.out.println("GOODBYE.");
System.out.println("VISIT US SOON.");
12
}
if((n==0)||(n>6))
{
System.out.println();
System.out.println(" YOU HAVE MADE THE WRONG
CHOICE. PLEASE TRY AGAIN");
obj.menu();
}
}
System.out.println("
CHOCOLATES");
System.out.println();
System.out.println();
System.out.println(" ___ ___
___ ___ ");
System.out.println("
.'\\__\\'\\__\\'\\__\\'\\ ");
System.out.println(" \\/ __\\/
__\\/ __\\/ __\\ ");
System.out.println("
\\'\\__\\'\\__\\'\\__\\'\\ ");
System.out.println(" \\/ __\\/
__\\/ __\\ /__\\ ");
System.out.println("
\\\\__\\'\\__\\'\\__\\__\\ ");
System.out.println();
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println();
14
System.out.println("05. Back");
System.out.println();
System.out.println();
chocolate = sc.nextInt();
System.out.println();
15
switch(chocolate)
{
case 1:
}
break;
case 2:
obj.menu();
}
break;
case 3:
obj.menu();
}
break;
case 4:
{
obj.menu();
}
break;
case 6:
obj.main();
break;
default:
System.out.println();
System.out.println("You have made the wrong choice");
System.out.println("Please make a correct choice");
obj.chocolates();
}
}
void delay()
20
{
int i;
for(i=0;i<=10000;i++)
{}
}
System.out.println();
System.out.println(" /> //
__");
System.out.println(" ___/ \\//
_/ /");
System.out.println(" ,' , \\_/ \\/
_/__");
System.out.println(" / _/ |--\\
` `~,");
System.out.println(" ' , ,/ /`\\ / `
` `,");
System.out.println(" | | | \\> `
` ` |");
System.out.println(" | , \\/ ' '
` ` /");
System.out.println(" `, ' ' ' `
' /");
System.out.println(" \\ ` ' '
, ,'");
System.out.println(" \\ ` ` ' ,
,/");
System.out.println(" `, ` ' ,
,'");
22
System.out.println(" \\ ` ,
/");
System.out.println(" `~---
-~'");
System.out.println();
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println();
System.out.println("01. Apples (1kg) Rs. 50 ");
System.out.println("02. Kiwi (1kg) Rs. 40");
System.out.println("03. Custard Apple (1kg) Rs.
45");
System.out.println("04. Bananas (1 dozen) Rs.
30");
System.out.println("05. Oranges (1kg) Rs. 60 ");
System.out.println("06. Back");
System.out.println();
System.out.println();
System.out.println("Enter the serial number - ");
fruit = sc.nextInt();
23
switch (fruit)
{
case 1:
break;
case 2:
case 3:
case 4:
case 5:
case 6:
28
obj.main();
break;
default:
System.out.println();
System.out.println("You have made the wrong choice");
System.out.println("Please make the correct choice");
obj.fruits();
}
}
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println("
VEGETABLES");
System.out.println(" \\.-'");
System.out.println(" '.; ;..'.-
'_'");
System.out.println(" '-
.\\.;//.'_.");
System.out.println(" '- '.;;.//
.-.");
System.out.println(" .-'-\\;,-
'-.");
System.out.println("
_\\_");
System.out.println(" //'\\");
System.out.println(" |`--
`|");
System.out.println("
|'__.|");
System.out.println(" |
|");
30
System.out.println(" |-..-
|");
System.out.println(" | ;");
System.out.println(" ;'--
//");
System.out.println(" \\//");
System.out.println("
\\(");
System.out.println("
\\.");
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println();
System.out.println("01. Potatoes (1kg) Rs. 20");
System.out.println("02. Lady Finger (1kg) Rs. 25");
System.out.println("03. Lettuce (1kg) Rs. 30 ");
System.out.println("04. Cabbage (1kg) Rs. 40");
System.out.println("05. Carrots (1kg) Rs. 35");
System.out.println("06. Back ");
System.out.println();
System.out.println();
31
{
obj.menu();
}
break;
case 2:
{
obj.menu();
}
break;
case 3:
{
obj.menu();
}
break;
case 4:
{
obj.menu();
}
break;
case 5:
{
obj.menu();
}
break;
case 6:
obj.main();
break;
default :
System.out.println();
System.out.println("You have made the wrong choice");
System.out.println("Please make the correct choice");
obj.vegetables();
}
}
{
Scanner sc = new Scanner(System.in);
ComputerProject obj = new ComputerProject();
int dairyproduct,dairyno,costtprice;
String dairyname;
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println(" DAIRY
PRODUCTS");
System.out.println();
System.out.println();
System.out.println("
_________");
System.out.println(" |
_______ |");
System.out.println(" //\\
\\");
System.out.println("
//__\\_________\\");
38
System.out.println(" | | \\
|");
System.out.println(" | | \\
|");
System.out.println(" | | \\
|");
System.out.println(" | | M \\
|");
System.out.println(" | | \\
|");
System.out.println(" | |\\ I \\
|");
System.out.println(" | | \\ \\
|");
System.out.println(" | | \\ L
\\ |");
System.out.println(" | | \\
\\|");
System.out.println(" | | \\
K |");
System.out.println(" | | \\
|");
System.out.println(" | | \\
|");
39
System.out.println("
|___|_______\\__|");
System.out.println();
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println();
System.out.println("01. Milk (1 litre) Rs. 40");
System.out.println("02. Yoghurt (500gm) Rs. 50");
System.out.println("03. Cheese (500 gm.) Rs. 45");
System.out.println("04. Ice Cream (1 litre) Rs. 80");
System.out.println("05. Back");
System.out.println();
System.out.println();
System.out.println("Enter the serial number - ");
dairyproduct = sc.nextInt();
System.out.println();
switch(dairyproduct)
{
40
case 1:
case 2:
case 3:
case 4:
43
case 5:
44
obj.main();
break;
default:
System.out.println();
System.out.println("You have made the wrong choice");
System.out.println("Please make the correct choice");
obj.dairyproducts();
}
}
totalprice[count]=total1;
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println(" Your order has
been added to cart");
System.out.println();
System.out.println(name[count]+" \t"+subname[count]+"
\t"+quantity[count]+" \t" +costprice[count]+"
\t"+totalprice[count]);
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
}
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println(" ALL IN
ONE GENERAL STORE" );
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println(" BILL
");
System.out.println();
Date now = new Date();
System.out.println("\t \t \t \t \t \t " + now);
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println("MAIN MENU SUB-MENU
QUANTITY COST PRICE TOTAL PRICE");
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
47
System.out.println();
for(i=0;i<=count;i++)
{
System.out.println();
System.out.println(name[i]+" "+subname[i]+"
"+quantity[i]+" "+costprice[i]+" \t"+totalprice[i]);
sum=sum+totalprice[i];
}
System.out.println();
System.out.println();
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println("YOUR GRAND TOTAL IS
Rs."+sum);
System.out.println("-------------------------------------------------
-------------------------------------------------------------------------
--------------------------------");
System.out.println();
System.out.println(" THANK
YOU FOR VISITING US");
System.out.println();
48
}//class ends
49
OUTPUT
50
51
52
53
54
55
56
57
58