# SHOPPING COUNTER

SHOPPING COUNTER
Posted in : Java Beginners

i need to do the system about the item from the small shop.

how can i calculate the item with price. if user choose more quantity from it. 1. ikan masin (price = 1.50) 2. garam (price = 1.00) 3. buttercup (price = 1.00) 4. mentega (price = 2.00) 5. honey (price = 3.00)

if customer pay more from the buying value, it will give the change. example : 3.00+2.00 = 5.00 customer pay 10.00 - 5.00 = 5.00

how can i do this coding with swtich case from the java.

thanks for helps.

October 21, 2010 at 12:20 PM

Hi Friend,

Try the following code:

```import java.util.*;

class Product{
public String item;
public int quantity;
public double price;
public double total;

public Product(){}
public Product(String item,int quantity, double price,double total) {
super();
this.item=item;
this.quantity= quantity;
this.price = price;
this.total=total;
}
public String getItem() {
return item;
}
public int getQuantity() {
return quantity;
}
public double getPrice() {
return price;
}
public double getTotal() {
}
}

public static void main(String[] args) throws Exception {
double sum=0.0;
List<Product> list = new ArrayList<Product>();
Scanner scan = new Scanner(System.in);
System.out.println();
System.out.println("1. Ikan masin");
System.out.println("2. Garam Masala");
System.out.println("3. Buttercup");
System.out.println("4. Mentega ");
System.out.println("5. Honey");
System.out.println("6. Customer Bill");
System.out.println("7. Exit");

boolean quit = false;
do{
System.out.println();

case 1:
System.out.print("Quantity: ");
int q1 = scan.nextInt();
System.out.print("Price: ");
double p1 = scan.nextDouble();
double t1=p1*q1;
break;
case 2:
System.out.print("Quantity: ");
int q2 = scan.nextInt();
System.out.print("Price: ");
double p2 = scan.nextDouble();
double t2=p2*q2;
break;
case 3:
System.out.print("Quantity: ");
int q3 = scan.nextInt();
System.out.print("Price: ");
double p3 = scan.nextDouble();
double t3=p3*q3;
break;
case 4:
System.out.print("Quantity: ");
int q4 = scan.nextInt();
System.out.print("Price: ");
double p4 = scan.nextDouble();
double t4=p4*q4;
case 5:
System.out.print("Quantity: ");
int q5 = scan.nextInt();
System.out.print("Price: ");
double p5 = scan.nextDouble();
double t5=p5*q5;
case 6:
quit = true;
System.out.println("Items   Quantity   Price   Total");
for (Product s : list){
System.out.println(s.getItem()+"        " +s.getQuantity()+"        "+s.getPrice()+"        " +s.getTotal());
sum+=s.getTotal();
}
System.out.print("Customer pays: ");
double pay=scan.nextDouble();
if(pay>sum){
double amt=pay-sum;
System.out.println("Give Change to Customer: "+amt);
}
else{
System.out.println("You have to pay "+sum);
System.out.print("Enter amount to pay:");
pay=scan.nextDouble();
}
break;
case 7:
quit=true;
break;
default:
System.out.println("Invalid Entry!");
}
}
while(!quit);
}
}
```

Thanks

October 23, 2010 at 1:08 AM

SHOPPING COUNTER
SHOPPING COUNTER  i need to do the system about the item from the small shop. how can i calculate the item with price. if user choose more quantity from it. 1. ikan masin (price = 1.50) 2. garam (price = 1.00) 3. buttercup
Servlet Counter
{ int counter = 0; public void doGet(HttpServletRequest request...(); counter++; pw.println("At present the value of the counter is " + counter); } } In the above example, which keeps track how many times the servlet
Counter program for java
Counter program for java  The problem is to count from 000 to 444 with recursion. The maximum digit is 4 so that the program will count from 000,001,002,003,004,010, 011 and so on. How can I solve
character counter - Java Beginners
of the entered(by user) name?  hy katy, import java.io.*; class counter { public counter() { System.out.print("Enter ur name:"); try... void main(String args[]) { new counter(); } } this code
counter - JSP-Interview Questions
********///////// A page with a counter This page has been visited: times. This counter never increases its value
shopping cart
shopping cart  hi i want the sample project for shopping cart in struts with mysql ,if any one knows means please help me
Shopping Cart
Shopping Cart  Give some same code for shopping cart.. once click "Add to cart button" add item into cart and also moved into next step
Shopping Cart,Shopping Cart software
counter.  Software Shopping cart is used around the world in e-commerce... Shopping Cart       Overview A web based shopping cart is something like the original
Shopping in Delhi
Shopping in Delhi  I heard about Connaught Place and Karol Bagh are best markets for shopping in Delhi. But is there any other market.. from where i can buy something traditional that can be related to Delhi as well as Indian
online shopping
online shopping   Hai sir/madam, i'm working on online shopping project.requirements is oracle10g,servlets/jsp... what is the difference b/w storing and saving image into database.how to store and how
online shopping
online shopping  hi, i am doing online shopping project i want to do online payment. How it can be possible
Free Java Shopping Cart,Shopping cart Application
Free Java Shopping Cart       Shopping Cart allows the web site owner to setup online store so that visitors can buy the product online. In other words, it assists online shopping customers
Shopping_Beauty
Shopping_Beauty  **Deleted by Admin** - BH Cosmetics, BHCosmetics is the best place on the web for 120 eyeshadow palette, 88 eyeshadow palette, eye shadow cosmetics and professional make up palettes
Shopping Cart
Shopping Cart Shopping cart is also know as trolley, carriage, buggy or wagon is a cart mostly used while shopping in shopping mall. These cart is provided at the time of shopping for collecting the goods while shopping. In case
complete coding for shopping card
complete coding for shopping card  complete coding for shopping card   Please visit the following link: Shopping Cart Application
Shopping cart
information at the checkout counter. Software Shopping cart is used around the world... Shopping cart Overview A web based shopping cart is something like the original grocery shop shopping cart that is used by the customer
online shopping project
online shopping project  Hi, i want online shopping project modules description and screens
online shopping project
online shopping project  Hi, i want online shopping project modules description and screens
jsp code for shopping cart
jsp code for shopping cart  please provide me the jsp code for online shopping cart
Shopping Cart
Shopping Cart In this section we will discuss about shopping cart and how you can use different open source shopping cart for hosting your shopping... online shopping portal and sale products online. Online portal is one
web hosting shopping cart
web hosting shopping cart  What is web hosting shopping cart? Please... for hosting the shopping cart application. Since shopping cart application... hosting companies specialized in shopping cart hosting will help you configuring
online shopping project
online shopping project  can you plz send the source code of online shopping application developed with the help of struts 1.2, hibernate and sql , jsp   Please visit the following link: Struts Shopping Cart
online shopping project
online shopping project  sir, plz can u send me the coding of simple application of online shopping cart project using jsp and servlets which should be run in netbeans without any errors
Using Bean Counter in JSP
Using Bean Counter in JSP       In this section you will learn how the counter bean can be used in jsp. As you all know a counter increments the value by one. Here, we will use
What is shopping cart?
What is shopping cart? In this tutorial we will understand the shopping cart. We will explain you what is a shopping cart? Why it is so popular these days... shopping cart software for selling their products online. What is shopping
Web hosting with shopping cart
Web hosting with shopping cart  Hi, What is the meaning of Web hosting with shopping cart? Can I use any cheap hosting provider to host my shopping cart? Why we should choose hosting company specialized in shopping cart hosting
online shopping portal
online shopping portal   Blockquote Scenario: Online Shopping Portal XYZ.com wants to create an online shopping portal for managing its registered customers and their shopping. The customers need to register themselves
Online Shopping Portal for xyz.com
Online Shopping Portal for xyz.com  XYZ.com wants to create an online shopping portal for managing its registered customers and their shopping. The customers need to register themselves first before they do shopping using
Online Shopping Portal for xyz.com
Online Shopping Portal for xyz.com  XYZ.com wants to create an online shopping portal for managing its registered customers and their shopping. The customers need to register themselves first before they do shopping using
Online Shopping Portal
Online Shopping Portal  XYZ.com wants to create an online shopping portal for managing its registered customers and their shopping. The customers need to register themselves first before they do shopping using the shopping