Reference no: EM13940283
Using Netbean 7.2 create a program satisfying the following:
- Constructor for the Invoice class requires subtotal and customer type only
- Methods make discount percent, discount amount and invoice total available
- Methods include accessors and mutators for both instance variables
- Includes methods which format invoice details for printing
- Modify InvoiceApp class to create an Invoice object
- Modify InvoiceApp class to invoke a getInvoice method which displays the formatted results
- Insure that running InvoiceApp produces proper results
- Insure that all classes compile
import java.text.NumberFormat;
import java.util.Scanner;
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
Scanner sc = new Scanner(System.in);
String choice = "y";
while(choice.equalsIgnoreCase("y"))
{
// get user entries
String customerType = Validator.getString(sc,
"Enter customer type (r/c): ");
double subtotal = Validator.getDouble(sc,
"Enter subtotal: ", 0, 10000);
// calculate the discount amount and total
double discountPercent = getDiscountPercent(subtotal, customerType);
double discountAmount = subtotal * discountPercent;
double total = subtotal - discountAmount;
// format the values
NumberFormat currency = NumberFormat.getCurrencyInstance();
NumberFormat percent = NumberFormat.getPercentInstance();
String sSubtotal = currency.format(subtotal);
String sCustomerType = "Unknown";
if (customerType.equalsIgnoreCase("r"))
sCustomerType = "Retail";
else if (customerType.equalsIgnoreCase("c"))
sCustomerType = "College";
String sDiscountPercent = percent.format(discountPercent);
String sDiscountAmount = currency.format(discountAmount);
String sTotal = currency.format(total);
// format and display the results
String message = "Subtotal: " + sSubtotal + "n"
+ "Customer type: " + sCustomerType + "n"
+ "Discount percent: " + sDiscountPercent + "n"
+ "Discount amount: " + sDiscountAmount + "n"
+ "Total: " + sTotal + "n";
System.out.println();
System.out.println(message);
System.out.print("Continue? (y/n): ");
choice = sc.next();
System.out.println();
}
}
static double getDiscountPercent(double subtotal, String type)
{
double discountPercent = 0.0;
if (type.equalsIgnoreCase("r"))
{
if (subtotal >= 500)
discountPercent = .2;
else if (subtotal >= 250 && subtotal < 500)
discountPercent =.15;
else if (subtotal >= 100 && subtotal < 250)
discountPercent =.1;
else if (subtotal < 100)
discountPercent =.0;
}
else if (type.equalsIgnoreCase("c"))
{
discountPercent = .2;
}
else
discountPercent = .05;
return discountPercent;
}
}
Application of data analysis within an organisation
: Compute this new variable and, for each store, please draw appropriate charts. Then determine 2-sided 95% confidence intervals for the mean of the Gather Rate for each store and compare.
|
Debt with a yield to maturity
: ABC Company has debt with a yield to maturity of 7%, a cost of common stock of 13%, and a cost of preferred stock 9%. The market values of its debt, preferred stock, and common stock are $10 millions. $3 millions, and $15 million, respectively, and i..
|
Trends that are affecting human resource management
: This assessment addresses these learning outcomes a) Examine trends that are affecting human resource management practice
|
Brazil agricultural so competitive
: 1. What is Brazil's agricultural so competitive? Why do its manufacturing industries lack competitiveness?2. Why have Brazil's governments in both the 20th and 21st century been eager to develop world-class manufacturing?
|
Includes methods which format invoice details for printing
: Constructor for the Invoice class requires subtotal and customer type only
|
What is your best estimate of the aftertax cost of debt
: Jiminy’s Cricket Farm issued a 20-year, 6 percent semiannual bond 2 years ago. The bond currently sells for 92 percent of its face value. The company’s tax rate is 40 percent. What is the company’s total book value of debt? What is your best estimate..
|
Journal entries to record the sale
: Prepare the journal entries to record the sale on November 17 ignore the cost of goods and collection on November 26, 2016, assuming that the gross method of accounting for cash discounts is used.
|
What is the expected price of the stock in a year
: What is the expected price of the stock in a year? Show that the expected return, 12%, equals dividend yield plus capital appreciation.
|
Appropriate template of a project plan online
: Find an appropriate template of a project plan online. Use the template to write a plan for your project. Prepare a 30 minute PowerPoint presentation of the plan and submit it to your lecturer
|