import java.util.Scanner;
/*
* Author: J. Murach
* Purpose: This program uses the console to get a subtotal
* from the user, and it calculates the discount amount and
* total and displays them.
*/
public class InvoiceApp
{
public static void main(String[] args)
{
// display a welcome message
System.out.println(
"Welcome to the Invoice Total Calculator");
System.out.println(); // print a blank line
// get the input from the user
Scanner sc = new Scanner(System.in);
System.out.print("Enter subtotal: ");
double subtotal = sc.nextDouble();
// calculate the discount amount and total
double discountPercent = .2;
double discountAmount = subtotal * discountPercent;
double invoiceTotal = subtotal - discountAmount;
// format and display the result
String message = "Discount percent: " +
discountPercent + "\n" +
"Discount amount: " + discountAmount + "\n" +
"Invoice total: " + invoiceTotal + "\n";
System.out.println(message);
}//main
}//class InvoiceApp