Respuesta :

Answer:

public class Invitation {

 private String hostname;

 private String address;

  public Invitation(String n, String a) {  // constructor that accepts two strings.

   hostname = n;

   address = a;

 }

  public String getHostname() {

   return hostname;

 }

 public void setAddress(String a) {

   address = a;

 }  

 public String invite(String guest) {

   return "Hello" +guest+ ", you are invited to my party at " +address+". "+hostname+".";

 }

 public Invitation(String host, String address) {

   this.address = address;

   this.hostname = host;

 }

}

Explanation:

The Java program defines a class called "Invitation". The class constructor has two string arguments or parameters for the host of the event and the address. The invite method is used to generate the string invite message with the name of the guest as the argument. Use the "setAddress" method to set a new location of the event and the "getHostname" to get the name of the event host.

To implement this task, I will be using Native Android code with Kotlin and the recent JetPack Compose Library, you will need Android studio to be able to run this code

//To mange the UI State we will be using view-model

class InviteViewModel: ViewModel() {

  // LiveData holds state which is observed by the UI

  // (state flows down from ViewModel)

  private val _name = MutableLiveData("")

  val name: LiveData<String> = _name

  // onNameChanged is an event we're defining that the UI can invoke

  // (events flow up from UI)

  fun Invite (newName: String) {

      _name.value = newName

  }

}

//Here is the MainActivity class where the code will run from

class Invitation : AppCompatActivity() {

  private val inviteViewModel by viewModels<InviteViewModel>()

  override fun onCreate(savedInstanceState: Bundle?) {

      /* ... */

      binding.textInput.doAfterTextChanged {

          inviteViewModel.onNameChanged(it.toString())

      }

      inviteViewModel.name.observe(this) { name ->

          binding.helloText.text = "Hello, $name"

      }

  }

}

Learn more:

https://brainly.com/question/24551910

RELAXING NOICE
Relax