View the step-by-step solution to:

Unit 7 Assignment Grading Information: This Program is due on Date Specified. Comments are REQUIRED; flow charts and pseudocode are NOT REQUIRED....


Please see attached assignment for Introduction to Computer Programming:

You will need this text file: addressList.txt. Be sure to put it in the same folder your .java files reside.

Unit 7 Assignment Grading Information: This Program is due on Date Specified . Comments are REQUIRED ; flow charts and pseudocode are NOT REQUIRED . Directions Points The files must be called < > (driver) < > (handles Address variables and methods) Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter . Only submit the . java files needed to make the program run. Do not submit the . class file or any other file. 5% Style Components Include properly formatted prologue, comments, indenting, and other style elements as shown in Chapter 2 starting page 64 and Appendix 5 page 881-892. 5% Topics covered in chapter Topics with * are covered in this assignment. Ensure you use every item listed below with an * in your completed assignment. *Relationships between reference variables and objects Reference assignment Memory space Equality of Objects Swap data in objects *Method call chaining *Object creating and initialization Calling one constructor from inside another Class variable usage Class methods Class constants Basic Requirements Write a driver class and an Address class that gets address data from file, process, and output the results. Refer to chapter 3 on how to read in a file. (driver) Provide a driver class that demonstrates this Address class. It should contain a main that does the following in the specified order: Print a welcome message (see sample) 20%
Background image of page 1
Print a loading message (see sample) Use the following code to load address data from a given text file “addressList.txt”. Scanner fileIn = new Scanner(new File("addressList.txt")); while ( fileIn.hasNext() ) { // read info from file String street, city, state, zip; // read street: // break into two reads to handle blank lines between addresses // next() will skip blank lines between addresses but stops at spaces, // and nextLine() will read in the rest of the street line street = + fileIn.nextLine(); city = fileIn.nextLine(); state = fileIn.nextLine(); zip = fileIn.nextLine(); // ADD CODE } // end file reading while fileIn.close(); // close file input Scanner object. Add into the above while loop: declare and initialize an Address object by invoking the 4-parameter constructor. Pass in the street, city, state, zip you just read from the file Add into the above while loop: call the display() method on the Address object to print this address (see sample for format) After the loop ends, print an end of list message (see sample) Print total # of addresses. Need to call the getAddressCount() class method of Address class. Print # of PO Box addresses. Need to call the getPOBoxAddressCount() class method of Address class. This demonstration driver does not call all accessor and mutator methods but it is normal to create them regardless of an immediate use. They may be needed in the future. Sample output is provided below. Be sure to mimic it exactly. 10% Write an Address class called that with the follow members: Four private instance data members, all of String type: street, city, state, and zipCode Two private class data members, both of int type: addressCount, poboxAddressCount. Both should be initialized to 0 within their declaration 60%
Background image of page 2
Show entire document
Sign up to view the entire interaction

Top Answer

Here is the explanation for... View the full answer


8700 NW River Park Dr.
64152 1600 Pennsylvania Ave NW
20500 PO Box 598
06002 1600 Amphitheatre Parkway
Mountain View
94043 PO BOX 34981

* @author
public class LiFiAddress {
/*class data members*/
private static int addressCount
= 0;
private static int poboxAddressCount= 0;
/*instance members*/
private String street;...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online