Question
Java - I need to change the following code to print everything aligned like so: Input: 100 Amazon 900 20000.00 purchasing@amazon.com 0.08 Nordstrom 210 50000.00
Java - I need to change the following code to print everything aligned like so:
Input:
100 Amazon 900 20000.00 purchasing@amazon.com 0.08 Nordstrom 210 50000.00 purchasing@nordstrom.com 0.07 Rutgers 010 32000.00 purchasing@rutgers.edu education Alamo 520 23000.00 purchasing@alamo.com 0.05 Kean 001 158000.50 purchasing@kean.edu education Allied 100 85300.00 purchasing@allied.com 0.06 JoesInc 950 999999.00 purchasing@joesinc.com 0.03 BostonU 697 340020.23 purchasing@tufts.edu education
Code:
OfficeCustomerClass:
public class OfficeCustomerClass { private String nameElement; private int id = 0; private double billBalanceElement; private String email; public OfficeCustomerClass() { nameElement=""; id=0; billBalanceElement=0; email=""; } // public OfficeCustomerClass(String nameElement, int id, double billBalanceElement, String email) { this.nameElement = nameElement; this.id = id; this.billBalanceElement = billBalanceElement; this.email = email; }
public void setnameElement(String nameElement) { this.nameElement = nameElement; }
public void setId(int id) { this.id = id; }
public void setbillBalanceElement(double billBalanceElement) { this.billBalanceElement = billBalanceElement; }
public void setEmail(String email) { this.email = email; }
public String getnameElement() { return nameElement; }
public int getId() { return id; }
public double getbillBalanceElement() { return billBalanceElement; }
public String getEmail() { return email; } public String toString() { return (nameElement+"\t"+id+"\t"+billBalanceElement+"\t\t"+email); } }//end of class
TaxExemptCustomerClass
public class TaxExemptCustomerClass extends OfficeCustomerClass{
private String taxLiabilityElement; public TaxExemptCustomerClass() { super(); taxLiabilityElement= ""; }
public TaxExemptCustomerClass(String nameElement, int id, double billBalanceElement, String email, String taxLiabilityElement) { super(nameElement,id,billBalanceElement,email); this.taxLiabilityElement = taxLiabilityElement; }
public void settaxLiabilityElement(String taxLiabilityElement) { this.taxLiabilityElement = taxLiabilityElement; }
public String gettaxLiabilityElement() { return taxLiabilityElement; }
public String toString() { return (super.toString()+"\t"+taxLiabilityElement); } }//end of class
TaxNonExemptCustomer
public class TaxNonExemptCustomer extends OfficeCustomerClass{
private double taxLiabilityElement;
public TaxNonExemptCustomer()
{
super();
taxLiabilityElement=0;
}
public TaxNonExemptCustomer(String nameElement, int id, double billBalanceElement, String email,double taxLiabilityElement)
{
super(nameElement,id,billBalanceElement,email);
settaxLiabilityElement(taxLiabilityElement);
}
public void settaxLiabilityElement(double taxLiabilityElement)
{
this.taxLiabilityElement = ((taxLiabilityElement*getbillBalanceElement())/100);
}
public double gettaxLiabilityElement()
{
return taxLiabilityElement ;
}
public String toString()
{
return(super.toString()+"\t"+taxLiabilityElement);
}
}
//
Current output:
Office Supplies Inc Customer Report Page1 Customer ID Email Address Balance Tax Type Tax Amount Kean Vassar Google purchasing@kean.edu purchasing@vassar.edu purchasing@google.com 158,000.50 53,000.00 500.50 education education tax liable 5.01Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started