Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
  • master
2 results

Target

Select target project
  • s3164918/webprogramming69
1 result
Select Git revision
  • main
  • master
2 results
Show changes
Commits on Source (2)
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="bookQuote:war" />
</artifacts-to-build>
</component>
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="92f55fe1-0069-4d42-91a6-b7e4e3dfaf3a" name="Changes" comment="added the classes for ex 5" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GitLabMergeRequestFiltersHistory"><![CDATA[{
"lastFilter": {
"state": "OPENED",
"assignee": {
"type": "org.jetbrains.plugins.gitlab.mergerequest.ui.filters.GitLabMergeRequestsFiltersValue.MergeRequestsMemberFilterValue.MergeRequestsAssigneeFilterValue",
"username": "s3164918",
"fullname": "Leersum, G.E.E. van (Guusje, Student B-TCS)"
}
}
}]]></component>
<component name="GitLabMergeRequestsSettings"><![CDATA[{
"selectedUrlAndAccountId": {
"first": "https://gitlab.utwente.nl/s3164918/webprogramming69.git",
"second": "5e303bca-31d4-4e41-a811-5bf278d8431c"
}
}]]></component>
<component name="LogFilters">
<option name="FILTER_ERRORS" value="false" />
<option name="FILTER_WARNINGS" value="false" />
<option name="FILTER_INFO" value="true" />
<option name="FILTER_DEBUG" value="true" />
<option name="CUSTOM_FILTER" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 1
}]]></component>
<component name="ProjectId" id="2fuKZJ89tX2rRvVq8Mu6CwVxeAI" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="openDirectoriesWithSingleClick" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "master",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RunManager">
<configuration name="Tomcat 10.1.23" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 10.1.23" ALTERNATIVE_JRE_ENABLED="false" nameIsGenerated="true">
<option name="UPDATING_POLICY" value="restart-server" />
<deployment>
<artifact name="bookQuote:war">
<settings>
<option name="CONTEXT_PATH" value="/bookQuote_war" />
</settings>
</artifact>
</deployment>
<server-settings>
<option name="BASE_DIRECTORY_NAME" value="2475523c-2340-4250-84cd-42c8aad2c53c" />
</server-settings>
<predefined_log_file enabled="true" id="Tomcat" />
<predefined_log_file enabled="true" id="Tomcat Catalina" />
<predefined_log_file id="Tomcat Manager" />
<predefined_log_file id="Tomcat Host Manager" />
<predefined_log_file id="Tomcat Localhost Access" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="52122" />
</RunnerSettings>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<method v="2">
<option name="Make" enabled="true" />
<option name="BuildArtifacts" enabled="true">
<artifact name="bookQuote:war" />
</option>
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="92f55fe1-0069-4d42-91a6-b7e4e3dfaf3a" name="Changes" comment="" />
<created>1714645577050</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1714645577050</updated>
<workItem from="1714645578137" duration="10664000" />
</task>
<task id="LOCAL-00001" summary="commit message">
<option name="closed" value="true" />
<created>1714645728118</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1714645728118</updated>
</task>
<task id="LOCAL-00002" summary="added the classes for ex 5">
<option name="closed" value="true" />
<created>1714656277692</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1714656277692</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="commit message" />
<MESSAGE value="added the classes for ex 5" />
<option name="LAST_COMMIT_MESSAGE" value="added the classes for ex 5" />
</component>
</project>
\ No newline at end of file
......@@ -38,5 +38,20 @@
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
package nl.utwente.di.bookQuote;
import java.io.*;
import jakarta.servlet.*;
import jakarta.servlet.http.*;
import java.util.HashMap;
/**
* Example of a Servlet that gets an ISBN number and returns the book price
*/
public class BookQuote extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
private Quoter quoter;
public void init() throws ServletException {
quoter = new Quoter();
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Book Quote";
// Done with string concatenation only for the demo
// Not expected to be done like this in the project
//**This is for the bookprices! **//
// out.println(
// "<!DOCTYPE HTML>\n" + "<HTML>\n" + "<HEAD><TITLE>" + title + "</TITLE>" + "<LINK REL=STYLESHEET HREF=\"styles.css\">" + "</HEAD>\n" + "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1>" + title + "</H1>\n" + " <P>ISBN number: " + request.getParameter(
// "isbn") + "\n" + " <P>Price: " + quoter.getBookPrice(
// request.getParameter("isbn")) + "</BODY></HTML>");
out.println(
"<!DOCTYPE HTML>\n" + "<HTML>\n" + "<HEAD><TITLE>" + title + "</TITLE>" + "<LINK REL=STYLESHEET HREF=\"styles.css\">" + "</HEAD>\n" + "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1>" + title + "</H1>\n" + " <P>degrees in celsius: " + request.getParameter(
"degrees") + "\n" + " <P>Fahrenheit: " + quoter.getFahrenheit(
request.getParameter("degrees")) + "</BODY></HTML>");
}
public static class Quoter {
private final HashMap<String, Double> books = new HashMap<>() {{
put("1", 10.0);
put("2", 45.0);
put("3", 20.0);
put("4", 35.0);
put("5", 50.0);
}};
public float getFahrenheit(String degrees) {
try {
return (Integer.valueOf(degrees) * 9 / 5) + 32;
} catch (NumberFormatException nfe) {
return 0;
}
}
public double getBookPrice(String isbn) {
if (books.containsKey(isbn)) {
return books.get(isbn);
}
return 0;
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">
<display-name>di.bookQuote</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description>BookQuote Servlet</description>
<display-name>BookQuote</display-name>
<servlet-name>BookQuote</servlet-name>
<servlet-class>nl.utwente.di.bookQuote.BookQuote</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BookQuote</servlet-name>
<url-pattern>/bookQuote</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
<!DOCTYPE HTML>
<!-- Front end for the webBookQuote Servlet. -->
<html lang="en">
<head>
<title>WOMP WOMP </title>
<link rel="stylesheet" href="styles.css">
<meta charset="UTF-8">
</head>
<body>
<div class="container">
<h1>Web Book Quote Application</h1>
<form ACTION="./bookQuote">
<p>Enter degrees in celsius: <input TYPE="TEXT" NAME="degrees"></p>
<input TYPE="SUBMIT">
</form>
</div>
</body>
</html>
BODY {
background-color: WHITE;
position: relative;
align-content: center;
height: 100vh;
width: 100vw;
}
H1 { color: PURPLE;
text-align: center;
font-size: 28px;
font-family: Arial, Helvetica, sans-serif;
font-weight: normal
}
.LARGER { font-size: 120% }
.TINY { font-size: 50% }
H2 { color: #440000;
text-align: center;
font-family: Arial, Helvetica, sans-serif
}
H3 { color: #440000;
text-align: center;
font-family: Arial, Helvetica, sans-serif
}
UL { margin-top: 0;
border-top-width: 0;
padding-top: 0
}
P { color: BLACK;
text-align: center;
font-size: 20px;
font-family: Arial, Helvetica, sans-serif
}
FORM { color: BLACK;
text-align: center;
font-size: 20px;
font-family: Arial, Helvetica, sans-serif
}
PRE { font-size: 105%;
}
CODE { font-size: 105%;
}
.TOC { font-size: 90%;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif
}
TH.COLORED { background-color: #FFAD00
}
TR.COLORED { background-color: #FFAD00
}
TH.TITLE { background-color: #ef8c29;
font-size: 40px;
font-family: Arial, Helvetica, sans-serif;
}
A:hover { color: red }
#container {}
package nl.utwente.di.bookQuote;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/*** Tests the Quoter */
public class TestQuoter {
@Test
public void testBook1() throws Exception {
BookQuote.Quoter quoter = new BookQuote.Quoter();
double price = quoter.getBookPrice("1");
Assertions.assertEquals(10.0, price, 0.0, "Price of book 1");
price = quoter.getBookPrice("2");
Assertions.assertEquals(45.0, price, 0.0, "Price of book 2");
}
}
\ No newline at end of file