Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java Instructions You can never be too careful with your data privacy Identity theft is a real issue... but we hope you don't have issues
java
Instructions You can never be too careful with your data privacy Identity theft is a real issue... but we hope you don't have issues with it today! Today's "PODjava example creates a person and then creates another person the identity theft) that has the same identity at the moment, they will just have the same first and last names!) "POD java makes use of the Person class. You are going to write the person class in "Personave You've been given an empty Person class. Inside this empty class, you will create the fields firstName and lastName. We have given you a constructor which takes in the first and last name and assigns them to those fields. We have also created a toStringll' method to output the first and last names separated by one space The main method in "Pojava' has been written for you. It reads in 2 strings, instartiates the class Person fonce as the targeted person and another the identity thefts "copy of that same person), and then prints out the result using the toString()" method Details Input The following input values are expected: a string [firstName the first name of the person (also used by the identity theft) - a string lastName) the last name of the person falso used by the identity theft) Processing Pobjava - Read in two strings first name of person, followed by last name) - Instantiate the class Person twice First, the person that is the target Second, the identity theft (a copy of the target person) Output the results using the 'toString)" method of "Personjava Personjava (this is where you need to do your work) - Create fields - a string firstName: the first name of the person a string lastName: the last name of the person Notes: - A constructor is already created for you which takes in the first and last name and assigns them to the appropriate fields AtoString() method exists which returns the first and last name separated by a space. Output The output is achieved by using the toString() method in the Person.java object class. It will be of the format "firstName + ** + lastName Sample input/output: Sample Input Sample Output Angela Angela Siegel Angela Siegel Siegel Brent Brent Crane Crane Brent Crane New Person.java3 POD.java CSCI 1110 @author Your Name public class Person // PLEASE START YOUR CODE HERE W 1/ PLEASE END YOUR CODE HERE //constructor public Person(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String toString() { return firstName + "" } lastName; } Person.java POD.java New 1 - /** 2 * CSCI 1110 3 * @author Your Name 4 */ 5 6 7. import java.util.Scanner; 8 9. public class POD { 10 11. public static void main(String [] args) { 12 13 Scanner in = new Scanner(System.in); 14 15 16 String firstName = in.next(); String lastName = in.next(); Person targetPerson = new Person(firstName, lastName); Person identity Thief = new Person(firstName, lastName); 17 18 19 20 21 22 23 24 25 26 27 28 } 29 Woutput using toString() method System.out.println(targetPerson); System.out.println(identityThief); System.out.print("END OF OUTPUT"); } 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