Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA Assume that the classes listed in the Java Quick
Question 1 SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA Assume that the classes listed in the Java Quick Reference have been imported where appropriate Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit The following class represents an iwitation to an event. The variable hostName represents the name of the host of the event and the variable address represents the location of the event public class Invitation private string host Name; private string address; public Invitation(String , String a) hostNamen address - a; (*) write a method for the Invitation class that retums the name of the host. Wire the method below 0/2 File Limit (b) Write a method for the Invitation class that accepts a parameter and uses it to update the address for the event. Write the method below. Upload fi (PDF, JPG, GIF, PNG, TXT, Word, Excel, Powerpoint file formats supported) 0/2 File Limit (c) Write a method for the Invitation class that will accept the name of a person who will be invited as a string parameter and return a string consisting of the name of the person being invited along with name of the host and location he event. For example, if the host name is "Karen", the party location is "1234 Walnut Street method should return a string in the following format and the person invited is "Cheryl.the Dear Cheryl, please attend my event at 1234 Walnut Street. See you then, Karen. Write the method below. Your implementation must conform to the example above (d) A student has written the following one parameter constructor to be included in the Invitation class. The method is intended to construct a new Invitation object that sets address to the value of the parameter and sets host Name to the default name "Host". The constructor does not work as intended. public Invitation(String address) address - address; hostName - "Host": Write a correct implementation of the one parameter Invitation constructor that avoids the error in the student's implementation, Write the method below
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