title: How to call a method with parameters as objects from another class java?
body: <p>I am trying NOT to just call the method by inputting the values manually, but to run a method of another class from another class. I tried to find out the solution by looking at the similar questions but they did not help me in this context.</p>
  <p>I might be wrong please forgive me, but this requirement is asking me to call a method with parameters, which I do not understand how to do.</p>
  <p>This is the requirement:</p>
  <blockquote>
  <p>a) Add a method payForHoliday() to the Member class.  This method will simply call a method in the Website class to pay for the holiday (i.e. to record the transaction with the website). And here we have a problem because the object from the Member class doesn't keep a record of which website the member is logged into.</p>
  </blockquote>
  <p>Class <strong>Website</strong>:</p>
  <pre><code>public class Website {
      private String websiteName;
      private double salesTotal;
      
      public Website(String newWebsiteName)
      {
          websiteName = newWebsiteName;
      }
  
      // lines omitted
  
      public void checkout(Member purchase, Holiday chosen) 
      {
          if (checkHitDiscount() == true)
          {
              System.out.println(&quot;Congrtulations you are eligible for 10% discount!&quot;);
              salesTotal = chosen.price;
          }
          else
          {
              System.out.println(&quot;successful completion of the transaction&quot;);
              salesTotal = chosen.price;
          }
      }
  </code></pre>
  <p>Class <strong>Member</strong>:</p>
  <pre><code>public class Member {
      private String email;
      public int membershipNumber;
      Holiday holiday;
      Website website;
  
      public Member(String newEmail, int newMembershipNumber)
      {
          email = newEmail;
          membershipNumber = newMembershipNumber;
      }
  
      // lines omitted
  
      public void payForHoliday(Member purchase, Holiday chosen) 
      {
           // This method needs to run the &quot;checkout()&quot; method in Website class
      }
  </code></pre>