Create an invoice that allows the user to manually enter from the keyboard, the
ID: 440209 • Letter: C
Question
Create an invoice that allows the user to manually enter from the keyboard, the following invoice data: Customer Account ID - (2 Letters followed by 3 digits) Customer Name Display the customer's bill for mail order delivered machine parts from Fly By Night Supply. The customer can order 0, 1, 2 or more of each part. Shodd Dee sells: Dunsels $10.25 each Widgets $ 8.75 each Lightweights $ 4.25 each Gidgets $ 5.22 each Fly By Night charges a 10% Shipping and Handling fee and a 8.5% Sales Tax (sales tax rate praised to offset the state deficit). The Shipping and Handling fee is based on the total of the order. The Sales Tax is based on the total of the order EXCLUDING the Shipping and Handling fee. Your application should perform the following: Enter the Customer's Account ID Enter the Customer Name Allow a clerk to enter the quantity of Dunsels, Widgets, Lightweights and Gidgets. A zero quantity valid entry. You cannot order a fraction of a part (i.e. 2.5 of a Whizbang cannot be ordered). Calculate the subtotal for each machine part, the Sales Tax, Shipping and Handling Fee and the Grand Total. Show an "itemized" display (that helps you debug any logic errors, confirms that the calculations are in fact correct and gives that user a "warm" fuzzy feeling about your calculations) such as: 2 Dunsels @ $10.25 $20.50 1 Widgets @ $8.75 $8.75 Sales Tax @ 8.75% $5.61 Shipping & Handling @ 10% $6.60 Since we have no, got to formatting, we may see Java "truncate" any traling zeroes. As we have not got to loops, this has to be executed for each customer individually.Explanation / Answer
Please rate...
Program invoice.java:
====================================================================
import java.util.Scanner;
class invoice
{
public static void main(String args[])
{
String cid;
String cname;
int dunsels;
int widgets;
int lightWeights;
int gidgets;
double total = 0;
Scanner s =new Scanner(System.in);
System.out.print("Enter customer account ID: ");
cid = s.nextLine();
System.out.print("Enter customer name: ");
cname = s.nextLine();
System.out.print("Enter number of Dunsels: ");
dunsels = s.nextInt();
System.out.print("Enter number of Widgets: ");
widgets = s.nextInt();
System.out.print("Enter number of Lightweigths: ");
lightWeights = s.nextInt();
System.out.print("Enter number of Gidgets: ");
gidgets = s.nextInt();
System.out.println("INVOICE =======");
System.out.println("Customer ID: "+cid);
System.out.println("Customer name: "+cname);
if(dunsels!=0)System.out.println(dunsels+" Dunsels @ $10.25 $"+(dunsels*10.25));
total=dunsels*10.25;
if(widgets!=0)System.out.println(widgets+" Widgets @ $8.75 $"+(widgets*8.75));
total+=widgets*8.75;
if(lightWeights!=0)System.out.println(lightWeights+" Lightweights @ $4.25 $"+(lightWeights*4.25));
total+=lightWeights*4.25;
if(gidgets!=0)System.out.println(gidgets+" Gidgets @ $5.22 $"+(dunsels*5.22));
total+=gidgets*5.22;
System.out.println();
System.out.println("Sales Tax @ 8.75% $"+(0.0875*total));
System.out.println("Shipping and Handling @ 10% $"+(0.1*total));
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.