Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Do not use the scanner class or any other user input request. You application should be self-contained and run without user input. Assignment Objectives Practice
Do not use the scanner class or any other user input request. You application should be self-contained and run without user input.
Assignment Objectives
- Practice on creating classes
- you will create the Student, Address and the BirthDate classes
- Practice on using information hiding
- Student, Address and BirthDate will have private attributes and provide get/set methods
- Learn how to create more complex classes
- the Student class uses other classes, Address and BirthDate as its attributes
Deliverables
A zipped Java project according to the How to submit Labs and Assignments guide.
O.O. Requirements (these items will be part of your grade)
- One class, one file. Don't create multiple classes in the same .java file
- Don't use static variables and methods
- Encapsulation: make sure you protect your class variables and provide access to them through get and set methods
- all the classes are required to have a constructor that receives all the attributes as parameters and updates the attributes accordingly
- all the classes are required to have an "empty" constructor that receives no parameters but updates all the attributes as needed
- Follow Horstmann's Java Language Coding Guidelines
- Organized in packages (MVC - Model - View Controller)
Contents
- Start with this NetBeans project Download this NetBeans projector create one with
- App.java
- Model
- Model.java
- Student.java
- Address.java
- BirthDate.java
Functionality
- The application App creates a Model object
- The Model class
- creates 3 Student objects
- displays information about the three students
- compares the birth dates of the three Student objects
- displays a message stating who is the oldest
The classes
- App
- it has the main method which is the method that Java looks for and runs to start any application
- it creates an object (an instance) of the Model class
- Model
- this is the class where all the action is going to happen
- it creates three students and compare their birth dates and displays a message stating who is older or if they are of the same age
- make sure you test your application for all the possible cases
- Student
- has the following attributes
- int studentId;
- String firstName;
- String lastName;
- BirthDate birthday;
- Address address;
- String phoneNumber;
- has the following attributes
- BirthDate
- it is a class (or type) which is used in Student defining the type of the attribute birthday
- it has three attributes
- int month;
- int day;
- int year;
- it also has a method that returns a formatted string with month, day, year:
- for instance: 10/10/2000
- Address
- it is a class (or type) which is used in Student defining the type of the attribute address
- it has the following attributes:
- String addressLine1
- String addressLine2
- String city
- String state
- int zipCode
- it also has a method that returns a formatted string such as (without the bullets):
- 25 Yearsley Mill Rd
- Media, PA 19063
Step 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