Please help me write the body of this method /** * Outputs the \"opening\" tags
ID: 3869795 • Letter: P
Question
Please help me write the body of this method
/**
* Outputs the "opening" tags in the generated HTML file. These are the
* expected elements generated by this method:
*
* <html>
* <head>
* <title>the channel tag title as the page title</title>
* </head>
* <body>
* <h1>the page title inside a link to the <channel> link</h1>
* <p>the channel description</p>
* <table border="1">
* <tr>
* <th>Date</th>
* <th>Source</th>
* <th>News</th>
* </tr>
*
* @param channel
* the channel element XMLTree
* @param out
* the output stream
* @updates out.content
* @requires [the root of channel is a <channel> tag] and out.is_open
* @ensures out.content = #out.content * [the HTML "opening" tags]
*/
private static void outputHeader(XMLTree channel, SimpleWriter out) {
assert channel != null : "Violation of: channel is not null";
assert out != null : "Violation of: out is not null";
assert channel.isTag() && channel.label().equals("channel") : ""
+ "Violation of: the label root of channel is a <channel> tag";
assert out.isOpen() : "Violation of: out.is_open";
/*
* TODO: fill in body
*/
}
Explanation / Answer
Ans: Body and html tags are missing
<html>
<head>
<title>the channel tag title as the page title</title>
</head>
<body>
<h1>the page title inside a link to the <channel> link</h1>
<p>the channel description</p>
<table border="1">
<tr>
<th>Date</th>
<th>Source</th>
<th>News</th>
</tr>
</body>
</html>
private static void outputHeader(XMLTree channel, SimpleWriter out) {
assert channel != null : "Violation of: channel is not null";
assert out != null : "Violation of: out is not null";
assert channel.isTag() && channel.label().equals("channel") : ""
+ "Violation of: the label root of channel is a <channel> tag";
assert out.isOpen() : "Violation of: out.is_open";
/*
* TODO: fill in body
*/
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.