subject

For this exercise, you are going to write your code in the FormFill class instead of the main method. The code is the same as if you were writing in the main method, but now you will be helping to write the class. It has a few instance variables that stores personal information that you often need to fill in various forms, such as online shopping forms. Read the method comments for more information.
As you implement these methods, notice that you have to store the result of concatenating multiple Strings or Strings and other primitive types. Concatenation produces a new String object and does not change any of the Strings being concatenated.
Pay close attention to where spaces should go in theString, too.
FormFillTester has already been filled out with some test code. Feel free to change the parameters to print your own information. If you don’t live in an apartment, just pass an empty String for the apartment number in setAddress.
Don’t put your real credit card information in your program!
When you run the program as written, it should output
Dog, Karel
123 Cherry Lane
Apt 4B
Card Number: 123456789
Expires: 10/2025
public class FormFill
{
private String fName;
private String lName;
private int streetNumber;
private String streetName;
private String aptNumber;
// Constructor that sets the first and last name
// streetNumber defaults to 0
// the others default to an empty String
public FormFill(String firstName, String lastName)
{
}
// Sets streetNumber, streetName, and aptNumber to the given
// values
public void setAddress(int number, String street, String apt)
{
}
// Returns a string with the name formatted like
// a doctor would write the name on a file
//
// Return string should be formatted
// with the last name, then a comma and space, then the first name.
// For example: LastName, FirstName
public String fullName()
{
}
// Returns the formatted address
// Formatted like this
//
// StreetNumber StreetName
// Apt AptNumber
//
// You will need to use the escape character \n
// To create a new line in the String
public String streetAddress()
{
} // Returns a string with the credit card information
// Formatted like this:
//
// Card Number: Card#
// Expires: expMonth/expYear
//
// Take information as parameters so we don't store sensitive information!
// You will need to use the escape character \n
public String creditCardInfo(int creditCardNumber, int expMonth, int expYear)
{ }
}
public class FormFillTester
{
public static void main(String[] args)
{
FormFill filler = new FormFill("Karel", "Dog");
filler. setAddress(123, "Cherry Lane", "4B");
System. out. println(filler. fullName());
System. out. println(filler. streetAddress());
System. out. println(filler. creditCardInfo(123456789, 10, 2025));
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
What is one of the main problems that can occur when implementing a large number of new systems within an organization?
Answers: 1
question
Computers and Technology, 22.06.2019 08:10
Technician a says that if a valve is open when a piston rises to the very top of a cylinder, the piston may actually strike the valve head and cause serious engine damage. technician b says if the camshaft is located in the engine block, then the engine is called an overhead valve engine, ohv engine, or an in-block camshaft. who is right? a. b only b. both a and b c. a only d. neither a nor b
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
You know the right answer?
For this exercise, you are going to write your code in the FormFill class instead of the main method...
Questions
question
Mathematics, 26.11.2020 01:00
Questions on the website: 13722361