SlideShare a Scribd company logo
1 of 12
CSE 110 - Lab 6
What this Lab Is About:
Problem Description: For this Lab you have to implement a
class Person. A person has a
fistname, lastname, address, and birthday year. Supply a
constructor and the following methods:
getName(), getAge(), getAddress, and changeAddress(),.
Step 1: Getting Started Create a class called Lab6. Be sure to
name your file Lab6.java.
Lab Documentation:
At the beginning of each programming assignment you must
have a comment block with the
following information:
/*------------------------------------------------------------------------
-
// AUTHOR: your name
// FILENAME: title of the source file
// SPECIFICATION: description of the program
// FOR: CSE 110- Lab #6
// TIME SPENT: how long it took you to complete the
assignment //----------------------------------
-------------------------*/
Step 2: Declaring Class
Examining the problem, we need to create a Person class,
declare Person class as follows
class Person {
}
Inside the class, declare some data members: a string variable
called firstname, a string variable
called lastname, and an integer called birthYear.
// declare some variables of different types:
// an string called firstname
//-->
// a string called lastname
//-->
// a string called address
//-->
// an int called birthYear
//-->
Step 3: Defining the constructor
Remember the constructor assigns input data to the data
members.
public Person (String fname, String lname, String
addr, int year)
{
// write the segment of code
//that assigns input data to the data members
}
Step4: Supply the methods
A method called getName() to get the name of an object Person:
public String getName()
{
// write a line of code
//that returns the last name
}
A method called getAge() to get the age of an object Person:
public int getAge(int currentYear)
{
// write a segment of code
//that returns the age
}
A method called getAddress() to get the age of an object
Person:
public String getAddress()
{
// write a line of code
//that returns the address
}
A method called changeAddress(String addr) to change the
address of an object Person:
public String changeAddress(String addr)
{
// write the segment of code
//that updates the address
}
Step4: Calling the constructor of Person class from the “main”
method
In order to use Person class variables and methods we need to
have a runner function.
For any class in java, “main” method will be the running
method.
You class Lab6 will have the main method.
public class Lab6{
public static void main(String[] args)
{
}
}
In order to use the Person class variables and methods, you need
to use the constructor to create
an object Person.
public class Lab6{
public static void main(String[] args)
{
//declare variables where you will store
//inputs from user
-->
// declare a Scanner object
-->
//prompt the user for inputs
//firstname, lastname, address, birthyear
-->
// store the input in the declared variables
-->
//use the constructor
//to create a brand-new object Person
-->
Hint: Do not forget to import the Scanner package at the very
top of your program:
Import java.util.Scanner
Step6: Calling Person class methods and display the output
The methods in the Person class will display the required
outputs.
//Call the getName() method in order to print the
//lastname of the object Person you just created.
//Call the getAge(currentYear) method in order to
//print the age.
--> System.out.println(“<PersonObject.getName()> is
<PersonObject.getAge(2016)> years old in 2016 and will
be <PersonObject>.getAge(2026)> years old in ten
years.“)
//Call the getAddres() method in order to
//print the address.
--> System.out.println(“<PersonObject.getName()> lives
in <PersonObject.getAddress()> ”);
Step7: Calling Person class methods
Now, call the changeAddress(addr) method in order to update
the address to the following
address:
<PersonObject>.changeAddress(“72 E University Dr
Tempe, AZ”);
Step8: Display the output
System.out.println(“<PersonObject.getName()> has moved to a
new
location: <PersonObject.getAddress()>
Sample Output
Below is an example of what your output should roughly look
like when this lab is completed.
All text in bold represents user input.
Sample Run 1:
Enter the first name of the person John
Enter the last name of the person Mann
Enter the address where the person lives E Rural Rd Tempe,
AZ.
Enter the birth year of the person 1991
Mann is 24 years old in 2016 and will be 34 years old in ten
years. Mann lives in E Rural Rd
Tempe, AZ.
Mann has moved to a new location: 72 E University Dr Tempe,
AZ
Sample Run 2:
Enter the first name of the person Ben
Enter the last name of the person Freeman
Enter the address where the person lives 700 Pelham Rd
Jacksonville, Florida.
Enter the birth year of the person 1981
Freeman is 34 in 2016 and will be 44 in ten years. Freeman
lives in 700 Pelham Rd
Jacksonville, Florida.
Freeman has moved to a new location: 72 E University Dr
Tempe, AZ.
Last Step: Submit your lab by following the instructions below:
*****************************************************
*************************
Submit your Lab6.java file to the Submission Server. Go to the
Submission Server site,
https://courses.eas.asu.edu/cse110b/login , then click on Lab
Submissions in the left frame. The
dropdown box will start in Lab6, so you don’t have to change it
(you will for future labs). Click
on the browse button and find where you saved your Lab6.java
file (and not the Lab6.class file)
on your computer. Upload the file to the site and then click on
the Submit button.
Your file will be submitted and a screen will show up
displaying if your program compiled and
what your output is when run on some sample input (in this case
nothing).
You should then check to make sure that the actual file
submitted properly and is readable to the
grader. To do so click on Grades in the frame on the left of the
page and then click on the 0
underneath Lab6. You will again see that your program
compiled and the sample output, but you
should scroll down to the bottom of the screen and make sure
your file is readable as well.
https://courses.eas.asu.edu/cse110/login
https://courses.eas.asu.edu/cse110/login
https://courses.eas.asu.edu/cse110b/login

More Related Content

Similar to CSE 110 - Lab 6 What this Lab Is About  Working wi.docx

First compile all the classes.But to run the program we have to run .pdf
First compile all the classes.But to run the program we have to run .pdfFirst compile all the classes.But to run the program we have to run .pdf
First compile all the classes.But to run the program we have to run .pdf
aoneonlinestore1
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdf
fashioncollection2
 
Code to copy Person.java .pdf
Code to copy Person.java .pdfCode to copy Person.java .pdf
Code to copy Person.java .pdf
anokhijew
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
irshadkumar3
 
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdfThis is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
jillisacebi75827
 

Similar to CSE 110 - Lab 6 What this Lab Is About  Working wi.docx (20)

First compile all the classes.But to run the program we have to run .pdf
First compile all the classes.But to run the program we have to run .pdfFirst compile all the classes.But to run the program we have to run .pdf
First compile all the classes.But to run the program we have to run .pdf
 
Computer programming 2 -lesson 4
Computer programming 2  -lesson 4Computer programming 2  -lesson 4
Computer programming 2 -lesson 4
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdf
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergrationSpring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
 
Code generating beans in Java
Code generating beans in JavaCode generating beans in Java
Code generating beans in Java
 
Best Of Jdk 7
Best Of Jdk 7Best Of Jdk 7
Best Of Jdk 7
 
Oop
OopOop
Oop
 
Code to copy Person.java .pdf
Code to copy Person.java .pdfCode to copy Person.java .pdf
Code to copy Person.java .pdf
 
Linq
LinqLinq
Linq
 
Random Class & File Handling.pptx
Random Class & File Handling.pptxRandom Class & File Handling.pptx
Random Class & File Handling.pptx
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
Dev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdfDev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdf
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
 
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdfThis is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
 
Assignment 7
Assignment 7Assignment 7
Assignment 7
 
Java assignment 1
Java assignment 1Java assignment 1
Java assignment 1
 

More from faithxdunce63732

Assignment DetailsScenario You are an investigator for Child .docx
Assignment DetailsScenario You are an investigator for Child .docxAssignment DetailsScenario You are an investigator for Child .docx
Assignment DetailsScenario You are an investigator for Child .docx
faithxdunce63732
 
Assignment DetailsScenario Generally, we have considered sexual.docx
Assignment DetailsScenario Generally, we have considered sexual.docxAssignment DetailsScenario Generally, we have considered sexual.docx
Assignment DetailsScenario Generally, we have considered sexual.docx
faithxdunce63732
 
Assignment DetailsPower’s on, Power’s Off!How convenient is.docx
Assignment DetailsPower’s on, Power’s Off!How convenient is.docxAssignment DetailsPower’s on, Power’s Off!How convenient is.docx
Assignment DetailsPower’s on, Power’s Off!How convenient is.docx
faithxdunce63732
 
Assignment DetailsIn 1908, playwright Israel Zangwill referred to .docx
Assignment DetailsIn 1908, playwright Israel Zangwill referred to .docxAssignment DetailsIn 1908, playwright Israel Zangwill referred to .docx
Assignment DetailsIn 1908, playwright Israel Zangwill referred to .docx
faithxdunce63732
 
Assignment DetailsMN551Develop cooperative relationships with.docx
Assignment DetailsMN551Develop cooperative relationships with.docxAssignment DetailsMN551Develop cooperative relationships with.docx
Assignment DetailsMN551Develop cooperative relationships with.docx
faithxdunce63732
 
Assignment DetailsInfluence ProcessesYou have been encourag.docx
Assignment DetailsInfluence ProcessesYou have been encourag.docxAssignment DetailsInfluence ProcessesYou have been encourag.docx
Assignment DetailsInfluence ProcessesYou have been encourag.docx
faithxdunce63732
 

More from faithxdunce63732 (20)

Assignment DetailsScenario You are member of a prisoner revie.docx
Assignment DetailsScenario You are member of a prisoner revie.docxAssignment DetailsScenario You are member of a prisoner revie.docx
Assignment DetailsScenario You are member of a prisoner revie.docx
 
Assignment DetailsScenario You are an investigator for Child .docx
Assignment DetailsScenario You are an investigator for Child .docxAssignment DetailsScenario You are an investigator for Child .docx
Assignment DetailsScenario You are an investigator for Child .docx
 
Assignment DetailsScenario You are a new patrol officer in a .docx
Assignment DetailsScenario You are a new patrol officer in a .docxAssignment DetailsScenario You are a new patrol officer in a .docx
Assignment DetailsScenario You are a new patrol officer in a .docx
 
Assignment DetailsScenario Generally, we have considered sexual.docx
Assignment DetailsScenario Generally, we have considered sexual.docxAssignment DetailsScenario Generally, we have considered sexual.docx
Assignment DetailsScenario Generally, we have considered sexual.docx
 
Assignment DetailsPower’s on, Power’s Off!How convenient is.docx
Assignment DetailsPower’s on, Power’s Off!How convenient is.docxAssignment DetailsPower’s on, Power’s Off!How convenient is.docx
Assignment DetailsPower’s on, Power’s Off!How convenient is.docx
 
Assignment DetailsIn 1908, playwright Israel Zangwill referred to .docx
Assignment DetailsIn 1908, playwright Israel Zangwill referred to .docxAssignment DetailsIn 1908, playwright Israel Zangwill referred to .docx
Assignment DetailsIn 1908, playwright Israel Zangwill referred to .docx
 
Assignment DetailsPart IRespond to the following.docx
Assignment DetailsPart IRespond to the following.docxAssignment DetailsPart IRespond to the following.docx
Assignment DetailsPart IRespond to the following.docx
 
Assignment DetailsPlease discuss the following in your main post.docx
Assignment DetailsPlease discuss the following in your main post.docxAssignment DetailsPlease discuss the following in your main post.docx
Assignment DetailsPlease discuss the following in your main post.docx
 
Assignment DetailsPennsylvania was the leader in sentencing and .docx
Assignment DetailsPennsylvania was the leader in sentencing and .docxAssignment DetailsPennsylvania was the leader in sentencing and .docx
Assignment DetailsPennsylvania was the leader in sentencing and .docx
 
Assignment DetailsPart IRespond to the followingReview .docx
Assignment DetailsPart IRespond to the followingReview .docxAssignment DetailsPart IRespond to the followingReview .docx
Assignment DetailsPart IRespond to the followingReview .docx
 
Assignment DetailsPart IRespond to the following questio.docx
Assignment DetailsPart IRespond to the following questio.docxAssignment DetailsPart IRespond to the following questio.docx
Assignment DetailsPart IRespond to the following questio.docx
 
Assignment DetailsPart IRespond to the following questions.docx
Assignment DetailsPart IRespond to the following questions.docxAssignment DetailsPart IRespond to the following questions.docx
Assignment DetailsPart IRespond to the following questions.docx
 
Assignment DetailsOne thing that unites all humans—despite cultu.docx
Assignment DetailsOne thing that unites all humans—despite cultu.docxAssignment DetailsOne thing that unites all humans—despite cultu.docx
Assignment DetailsOne thing that unites all humans—despite cultu.docx
 
Assignment DetailsMN551Develop cooperative relationships with.docx
Assignment DetailsMN551Develop cooperative relationships with.docxAssignment DetailsMN551Develop cooperative relationships with.docx
Assignment DetailsMN551Develop cooperative relationships with.docx
 
Assignment DetailsInfluence ProcessesYou have been encourag.docx
Assignment DetailsInfluence ProcessesYou have been encourag.docxAssignment DetailsInfluence ProcessesYou have been encourag.docx
Assignment DetailsInfluence ProcessesYou have been encourag.docx
 
Assignment DetailsIn this assignment, you will identify and .docx
Assignment DetailsIn this assignment, you will identify and .docxAssignment DetailsIn this assignment, you will identify and .docx
Assignment DetailsIn this assignment, you will identify and .docx
 
Assignment DetailsFinancial statements are the primary means of .docx
Assignment DetailsFinancial statements are the primary means of .docxAssignment DetailsFinancial statements are the primary means of .docx
Assignment DetailsFinancial statements are the primary means of .docx
 
Assignment DetailsIn this assignment, you will identify a pr.docx
Assignment DetailsIn this assignment, you will identify a pr.docxAssignment DetailsIn this assignment, you will identify a pr.docx
Assignment DetailsIn this assignment, you will identify a pr.docx
 
Assignment DetailsHealth information technology (health IT) .docx
Assignment DetailsHealth information technology (health IT) .docxAssignment DetailsHealth information technology (health IT) .docx
Assignment DetailsHealth information technology (health IT) .docx
 
Assignment DetailsDiscuss the followingWhat were some of .docx
Assignment DetailsDiscuss the followingWhat were some of .docxAssignment DetailsDiscuss the followingWhat were some of .docx
Assignment DetailsDiscuss the followingWhat were some of .docx
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

CSE 110 - Lab 6 What this Lab Is About  Working wi.docx

  • 1. CSE 110 - Lab 6 What this Lab Is About: Problem Description: For this Lab you have to implement a class Person. A person has a fistname, lastname, address, and birthday year. Supply a constructor and the following methods: getName(), getAge(), getAddress, and changeAddress(),. Step 1: Getting Started Create a class called Lab6. Be sure to name your file Lab6.java. Lab Documentation: At the beginning of each programming assignment you must have a comment block with the following information: /*------------------------------------------------------------------------ - // AUTHOR: your name
  • 2. // FILENAME: title of the source file // SPECIFICATION: description of the program // FOR: CSE 110- Lab #6 // TIME SPENT: how long it took you to complete the assignment //---------------------------------- -------------------------*/ Step 2: Declaring Class Examining the problem, we need to create a Person class, declare Person class as follows class Person { } Inside the class, declare some data members: a string variable called firstname, a string variable called lastname, and an integer called birthYear. // declare some variables of different types: // an string called firstname //-->
  • 3. // a string called lastname //--> // a string called address //--> // an int called birthYear //--> Step 3: Defining the constructor Remember the constructor assigns input data to the data members. public Person (String fname, String lname, String addr, int year) { // write the segment of code //that assigns input data to the data members
  • 4. } Step4: Supply the methods A method called getName() to get the name of an object Person: public String getName() { // write a line of code //that returns the last name } A method called getAge() to get the age of an object Person: public int getAge(int currentYear) { // write a segment of code //that returns the age }
  • 5. A method called getAddress() to get the age of an object Person: public String getAddress() { // write a line of code //that returns the address } A method called changeAddress(String addr) to change the address of an object Person: public String changeAddress(String addr) { // write the segment of code //that updates the address } Step4: Calling the constructor of Person class from the “main” method
  • 6. In order to use Person class variables and methods we need to have a runner function. For any class in java, “main” method will be the running method. You class Lab6 will have the main method. public class Lab6{ public static void main(String[] args) { } } In order to use the Person class variables and methods, you need to use the constructor to create an object Person. public class Lab6{ public static void main(String[] args) {
  • 7. //declare variables where you will store //inputs from user --> // declare a Scanner object --> //prompt the user for inputs //firstname, lastname, address, birthyear --> // store the input in the declared variables --> //use the constructor //to create a brand-new object Person --> Hint: Do not forget to import the Scanner package at the very top of your program: Import java.util.Scanner
  • 8. Step6: Calling Person class methods and display the output The methods in the Person class will display the required outputs. //Call the getName() method in order to print the //lastname of the object Person you just created. //Call the getAge(currentYear) method in order to //print the age. --> System.out.println(“<PersonObject.getName()> is <PersonObject.getAge(2016)> years old in 2016 and will be <PersonObject>.getAge(2026)> years old in ten years.“) //Call the getAddres() method in order to //print the address. --> System.out.println(“<PersonObject.getName()> lives in <PersonObject.getAddress()> ”);
  • 9. Step7: Calling Person class methods Now, call the changeAddress(addr) method in order to update the address to the following address: <PersonObject>.changeAddress(“72 E University Dr Tempe, AZ”); Step8: Display the output System.out.println(“<PersonObject.getName()> has moved to a new location: <PersonObject.getAddress()> Sample Output Below is an example of what your output should roughly look like when this lab is completed. All text in bold represents user input. Sample Run 1: Enter the first name of the person John Enter the last name of the person Mann Enter the address where the person lives E Rural Rd Tempe,
  • 10. AZ. Enter the birth year of the person 1991 Mann is 24 years old in 2016 and will be 34 years old in ten years. Mann lives in E Rural Rd Tempe, AZ. Mann has moved to a new location: 72 E University Dr Tempe, AZ Sample Run 2: Enter the first name of the person Ben Enter the last name of the person Freeman Enter the address where the person lives 700 Pelham Rd Jacksonville, Florida. Enter the birth year of the person 1981 Freeman is 34 in 2016 and will be 44 in ten years. Freeman lives in 700 Pelham Rd Jacksonville, Florida. Freeman has moved to a new location: 72 E University Dr Tempe, AZ.
  • 11. Last Step: Submit your lab by following the instructions below: ***************************************************** ************************* Submit your Lab6.java file to the Submission Server. Go to the Submission Server site, https://courses.eas.asu.edu/cse110b/login , then click on Lab Submissions in the left frame. The dropdown box will start in Lab6, so you don’t have to change it (you will for future labs). Click on the browse button and find where you saved your Lab6.java file (and not the Lab6.class file) on your computer. Upload the file to the site and then click on the Submit button. Your file will be submitted and a screen will show up displaying if your program compiled and what your output is when run on some sample input (in this case nothing). You should then check to make sure that the actual file submitted properly and is readable to the grader. To do so click on Grades in the frame on the left of the page and then click on the 0 underneath Lab6. You will again see that your program compiled and the sample output, but you
  • 12. should scroll down to the bottom of the screen and make sure your file is readable as well. https://courses.eas.asu.edu/cse110/login https://courses.eas.asu.edu/cse110/login https://courses.eas.asu.edu/cse110b/login