As a software developer, you are likely to be part of a software development team. Being able to divide a project up and work well with others are important skills. Collaboration at a distance can be challenging but is becoming more common. This task will give you experience to collaborate on a software development project with a partner who is not on site.
Task
Note: To complete this task, you will need the latest Java SE Development Kit (JDK). This includes the Java Runtime Environment (JRE) and command line development tools that are useful for developing applets and applications. It is recommended that you complete this assignment using NetBeans Integrated Development Environment. To download this program, see the web link below.
Write an application that does the following:
Creates class Invoice
Declares class member variable called numberOfInvoices that is incremented each time a new invoice is created
Declares the four following instance member variables:
companyName (which stores String representing name of Company)
amountDue of type double
chargeDate of type String
invoiceNumber of type int where invoiceNumber is initialized to ++numberOfInvoices
Makes all member variables private to hide and encapsulate data
Implements the four following public getters to retrieve current values of all private members:
getCompanyName()
getAmountDue()
getChargeDate()
getInvoiceNumber()
Implements the three following public setters to set values of all private members:
setCompanyName(String coName)
setAmountDue(double Amount)
setChargeDate(String dateCharged)
Creates required public constructors, including one that uses all setters to initialize all private attributes: companyName, amountDue, and chargeDate
Implements class (static) method getNumberOfInvoices() to return numberOfInvoices
Write a test application that does the following to create three Invoices to test the class developed in part A:
Creates an instance of Invoice and uses the Invoice constructor to initialize the following private attributes: companyName is “Amazing Software”, amountDue is “5,000.00”, and chargeDate is “January 18, 2009”
Creates an instance of Invoice and uses the Invoice constructor to initialize the following private attributes: companyName is “Best Programs”, amountDue is “4,000.00”, and chargeDate is “February 18, 2009”
Creates an instance of Invoice and uses the Invoice constructor to initialize the following private attributes: companyName is “Champion Code”, amountDue is “3,000.00”, and chargeDate is “March 18, 2009”
Uses class method getNumberOfInvoices() to get and print class member variable called numberOfInvoices without instantiating another Invoice
When finished with your application, evaluate your programmed solution and discuss the following questions with your partner:
What techniques did you use for information hiding and encapsulation? Are there any improvements you would make? If so, what would they be?
Which members were instance members? Did you have any class members?
What would the result be if you made numberOfInvoices a final variable?
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.