Problem Write a class named Person that has attributes for name, age, and occupation. These attributes should be private. Create getters and setters for each attribute following Java conventions. Expected Output • Declare the instance new Person("Citra Curie", 16, "student")| • The method getName() returns citra Curie • The method setName("Rowan Faraday") changes the name attribute to "Rowan Faraday" • The method getáge() returns 16 • The method setage(18) changes the age attribute to 18 • The method getOccupation() returns student • The method setoccupation("plumber") changes the occupation attribute to "plumber" Testing Your Code Use the button below to test your code before submitting it for evaluation.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Do the code in Java Language

Problem
Write a class named Person that has attributes for name, age, and occupation.
These attributes should be private. Create getters and setters for each attribute
following Java conventions.
Expected Output
• Declare the instance new Person("Citra Curie", 16, "student")
• The method getName() returns Citra Curie
• The method setName("Rowan Faraday") changes the name attribute to "Rowan
Faraday"
• The method getage() returns 16
• The method setAge(18) changes the age attribute to 18
• The method getOccupation() returns student
• The method setőccupation("plumber") changes the occupation attribute to
"plumber"
Testing Your Code
Use the button below to test your code before submitting it for evaluation.
Transcribed Image Text:Problem Write a class named Person that has attributes for name, age, and occupation. These attributes should be private. Create getters and setters for each attribute following Java conventions. Expected Output • Declare the instance new Person("Citra Curie", 16, "student") • The method getName() returns Citra Curie • The method setName("Rowan Faraday") changes the name attribute to "Rowan Faraday" • The method getage() returns 16 • The method setAge(18) changes the age attribute to 18 • The method getOccupation() returns student • The method setőccupation("plumber") changes the occupation attribute to "plumber" Testing Your Code Use the button below to test your code before submitting it for evaluation.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education