Reference no: EM13763509
Modify the code so it displays the number of invoices, the average invoice amount, and the average discount amount when the user ends the program. Then, test this change.
import java.util.Scanner;
public class InvoiceApp
{
public static void main(String[] args)
{
// welcome the user to the program
System.out.println("Welcome to the Invoice Total Calculator");
System.out.println(); // print a blank line
// create a Scanner object named sc
Scanner sc = new Scanner(System.in);
// perform invoice calculations until choice isn't equal to "y" or "Y"
String choice = "y";
while (choice.equalsIgnoreCase("y"))
{
// get the invoice subtotal from the user
System.out.print("Enter subtotal: ");
double subtotal = sc.nextDouble();
// calculate the discount amount and total
double discountPercent= 0.0;
if (subtotal >= 200)
discountPercent = .2;
else if (subtotal >= 100)
discountPercent = .1;
else
discountPercent = 0.0;
double discountAmount = subtotal * discountPercent;
double total = subtotal - discountAmount;
// display the discount amount and total
String message = "Discount percent: " + discountPercent + "n"
+ "Discount amount: " + discountAmount + "n"
+ "Invoice total: " + total + "n";
System.out.println(message);
// see if the user wants to continue
System.out.print("Continue? (y/n): ");
choice = sc.next();
System.out.println();
}
}
}
Compare and contrast japan and spain
: Write the economic analysis section of a business proposal. This will include statements about the market structure and the elasticity of demand for the good or service, based on text book principles.
|
Discuss waterfall model technique
: discuss waterfall model technique of software design
|
Identify an operational definition used by the researchers
: Locate a recent criminal justice research article from a recognized peer-reviewed professional journal or government publication. Identify an operational definition used by the researchers
|
Define annual salary calculator
: Create a simple ASP.NET web application using Microsoft Visual Studio 2008 that displays the text "Hello, World" on the home page. You will also add a page and build an Annual Salary Calculator on that page. This will be used as the foundation for..
|
Displays the number invoices-average invoice amount
: Modify the code so it displays the number of invoices, the average invoice amount, and the average discount amount when the user ends the program. Then, test this change.
|
What rights does money matters have against hometown bank
: What rights does Money Matters have against Hometown Bank, Lana's Lumberyard, and Brightday Builders
|
Create an asp.net web application
: Create an ASP.NET web application main form containing a list of hyperlinks and images. You will also add a form with five text boxes and a Submit button.
|
Calculate weekly payroll
: You work for a local construction firm, "DeVry Engineering Group" and your supervisor wants to test your knowledge and skills with Microsoft Excel and has instructed you to develop a spreadsheet to calculate weekly payroll for "15" employees with ..
|
Ethical issues or concerns about mcos providing
: Discuss the ethical issues or concerns about MCOs providing a lower quality of care compared to traditional fee-for-service (FFS) organizations?
|