Shopping Cart

  • Uploaded by: david johnson
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Shopping Cart as PDF for free.

More details

  • Words: 152
  • Pages: 2
Shopping Cart /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package practiceshop; import java.text.*; /** * * @author david johnson */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here //define double newPrice = 0; int numUnits = 0; double totalValue = 0; String choice = "yes"; //while loop while (choice.equalsIgnoreCase("yes")) { System.out.print("Please enter the price of the new item: "); newPrice = MyInput.readDouble(); System.out.print("Pleae enter the units of the item: "); numUnits = MyInput.readInt();

double newTotal = newPrice * numUnits; totalValue = newTotal + totalValue; System.out.println("Continue? (yes/no): "); choice = MyInput.readString(); }//while loop ends //currency

NumberFormat currency = NumberFormat.getCurrencyInstance(); //process double taxRate = 8.5 / 100; double totalPrice = totalValue * (1 + taxRate); //output System.out.println("The new total is: " + currency.format(totalPrice)); } }

Related Documents

Shopping Cart
November 2019 33
Shopping Cart Tables
November 2019 15
Shopping Cart Dfds
November 2019 19
Shopping
November 2019 38

More Documents from ""

Syll_fall_2008
November 2019 17
Acct 101 Syllabus
November 2019 27
Classex For Loop
November 2019 24
Jake S Client And Pet Data
November 2019 20
Mortgage Table
November 2019 18