-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.html
22 lines (22 loc) · 1.6 KB
/
task.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<h2>Greetings</h2>
<html>
<head></head>
<body>
<p>Below is a class <code class="java">Person</code> and you want to add a method <code class="java">greet</code> to this class. This method is supposed to return the message <code class="java">Hello, I am {name}!</code> where <code class="java">name</code> is the name of this person.</p>
<p>Your task here is to define this method; create an instance of the class <code class="java">Person</code> with the input as the parameter <code class="java">name</code>; call the method <code class="java">greet</code> on this instance and print the result.</p>
<p>You can see an example below.</p>
<p><strong>The input format:</strong></p>
<p>The name of the person.</p>
<p><strong>The output format:</strong></p>
<p>The output of the method <code class="java">greet</code>.</p>
<p><button class="btn-sm btn-outline-secondary" onclick="getElementById('hint-678').style.display='inline'"> Hint </button> </p>
<div id="hint-678" style="display:none;">
The method
<code class="java">greet</code> doesn't need any parameters other than
<code class="java">self</code>: you can obtain the name from the attribute
<code class="java">self.name</code>.
</div>
<p></p>
</body>
</html><br><b>Sample Input:</b><br><pre><code class="language-no-highlight">David</code></pre><br><b>Sample Output:</b><br><pre><code class="language-no-highlight">Hello, I am David!</code></pre><br><br><br><font color="gray">Memory limit: 256 MB</font><br><font color="gray">Time limit: 15 seconds</font><br><br>
<a href="https://hyperskill.org/learn/step/6931">Show topic summary</a>