Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner;// import the Scanner public class BestPurchaseOnline { public static void main(String[] args) { Scanner input = new Scanner(System.in);// create the Scanner //Declare the

import java.util.Scanner;// import the Scanner public class BestPurchaseOnline { public static void main(String[] args) { Scanner input = new Scanner(System.in);// create the Scanner //Declare the variables String sName = "";//variable for customer name int nItem = 0; int nPricePerItem = 0; double dSalesTax = 0; int nCount = 0; int nItemOrder = 0; int nSumItem = 0; int nTotalAmountDue = 0; int nPriceOfItem = 0; //Declare Constant final int SENTINEL = 10; // value to end number of item System.out.print("Please enter your name: "+sName); sName = input.nextLine(); System.out.println(" BEST PURCHASE PRODUCTS"); System.out.println("1. Smartphone $249"); System.out.println("2. Smartphone case $39"); System.out.println("3. PC Laptop $1149"); System.out.println("4. Tablet $349"); System.out.println("5. Tablet case $49"); System.out.println("6. eReader $119"); System.out.println("7. PC Desktop $899"); System.out.println("8. LED Monitor $299"); System.out.println("9. Laser Printer $399"); System.out.println("10.Complete my order"); System.out.println("Please select an item from the menu above: "); nItem = input.nextInt(); while(nItem!=SENTINEL){ nCount++; // nCount = nCount + 1; nSumItem = nSumItem + nItem; System.out.println("Please select another item from the menu above: "); nItem = input.nextInt(); if(nItem==1){ nPricePerItem=249; System.out.println("Please select another item from the menu above: "); nPricePerItem = input.nextInt(); } } System.out.println("Thank you for ordering with Best Purchase, "+sName); nItemOrder = (nCount); System.out.println("Total items ordered: "+nItemOrder); System.out.println("Price of items ordered:$ "+ nSumItem); dSalesTax = (0.65 * nPricePerItem); System.out.println("Sales Tax:$ "+dSalesTax); System.out.println("Total amount due:$ "); }// end main method }// end class BestPurchaseOnline

run: Please enter your name: m j

BEST PURCHASE PRODUCTS 1. Smartphone $249 2. Smartphone case $39 3. PC Laptop $1149 4. Tablet $349 5. Tablet case $49 6. eReader $119 7. PC Desktop $899 8. LED Monitor $299 9. Laser Printer $399 10.Complete my order Please select an item from the menu above: 1 Please select another item from the menu above: 1 Please select another item from the menu above: 10 Please select another item from the menu above: 10 Thank you for ordering with Best Purchase, m j Total items ordered: 2 Price of items ordered:$ 2 Sales Tax:$ 6.5 Total amount due:$

I need help with the BOLD output information

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago