Skip to content
Snippets Groups Projects
Commit 5e75a1d2 authored by Härmä Sakari's avatar Härmä Sakari
Browse files

Tarkastuksessa havaitut virheet korjattu

parent 327605f6
Branches tyo8.2
Tags vaihe8.2
No related merge requests found
......@@ -26,8 +26,8 @@
<change beforePath="$PROJECT_DIR$/../../HarmjosaHT/HarmjosaHT/obj/project.nuget.cache" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../HarmjosaHT/HarmjosaHT/obj/project.packagespec.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../HarmjosaHT/HarmjosaHT/obj/rider.project.restore.info" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.HarmjosaHT/.idea/indexLayout.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HarmjosaHT/.idea/indexLayout.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.HarmjosaHT/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HarmjosaHT/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HarmjosaHT.sln" beforeDir="false" afterPath="$PROJECT_DIR$/HarmjosaHT.sln" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HarmjosaHT/HarmjosaHT.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HarmjosaHT/HarmjosaHT.cs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
......@@ -97,7 +97,7 @@
<updated>1721287852058</updated>
<workItem from="1721287854252" duration="60000" />
<workItem from="1722860504752" duration="564000" />
<workItem from="1722874388227" duration="1997000" />
<workItem from="1722874388227" duration="4279000" />
</task>
<servers />
</component>
......

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarmjosaHT", "HarmjosaHT\HarmjosaHT.csproj", "{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarmjosaHTTest", "HarmjosaHTTest/HarmjosaHTTest.csproj", "{2A00C50C-D7C7-48AB-AAD2-D00EDA9AF579}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Release|Any CPU.Build.0 = Release|Any CPU
{2A00C50C-D7C7-48AB-AAD2-D00EDA9AF579}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A00C50C-D7C7-48AB-AAD2-D00EDA9AF579}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A00C50C-D7C7-48AB-AAD2-D00EDA9AF579}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A00C50C-D7C7-48AB-AAD2-D00EDA9AF579}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarmjosaHT", "HarmjosaHT\HarmjosaHT.csproj", "{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BB73C9E-21F9-41E2-9CDA-46675079BFBE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
......@@ -14,36 +14,42 @@ public class HarmjosaHT
{
Console.Write("Anna paneloitavan alueen pituus metreinä >");
double a = double.Parse(Console.ReadLine());
if (a > 50)
double maxpituus = 50;
if (a > maxpituus)
{
Console.Write("Oletko varma, että luku on metreinä. Anna pituus uudelleen >");
Console.Write("Oletko varma, että luku on metreinä? Anna pituus uudelleen >");
a = double.Parse(Console.ReadLine());
}
Console.Write("Anna paneloitavan alueen leveys metreinä >");
double b = double.Parse(Console.ReadLine());
if (b > 50)
if (b > maxpituus)
{
Console.Write("Oletko varma, että luku on metreinä. Anna leveys uudelleen >");
Console.Write("Oletko varma, että luku on metreinä? Anna leveys uudelleen >");
b = double.Parse(Console.ReadLine());
}
Console.Write("Anna haluttu paneelin leveys millimeterinä >");
Console.Write("Anna haluttu paneelin leveys millimetreinä >");
double c = double.Parse(Console.ReadLine());
if (c > 300 || c < 10)
double paneelinmaxleveys = 300;
double paneelinminleveys = 20;
if (c > paneelinmaxleveys || c < paneelinminleveys )
{
Console.Write("Oletko varma, että luku on millimetreinä. Anna leveys uudelleen >");
Console.Write("Oletko varma, että luku on millimetreinä? Anna leveys uudelleen >");
c = double.Parse(Console.ReadLine());
}
Console.Write("Anna ostettavan panelin pituus metreinä >");
double d = double.Parse(Console.ReadLine());
if (d > 10 || d < 1)
double paneelinmaxpituus = 10;
double paneelinminpituus = 1;
if (d > paneelinmaxpituus || d < paneelinminpituus)
{
Console.Write("Oletko varma, että luku on millimetreinä. Anna leveys uudelleen >");
c = double.Parse(Console.ReadLine());
Console.Write("Oletko varma, että luku on millimetreinä? Anna leveys uudelleen >");
d = double.Parse(Console.ReadLine());
}
......@@ -58,6 +64,7 @@ public class HarmjosaHT
}
/// <summary>
/// Aliohjelma laskee paneloitavan alueen pinta-alan ja paneelin pinta-alan
/// ja sitten jakaa alueen pinta-alan paneelin pinta-alalla.
......@@ -68,12 +75,11 @@ public class HarmjosaHT
/// <param name="b">Alueen leveys</param>
/// <param name="c">Panelin leveys</param>
/// <param name="d">Panelin pituus</param>
/// <returns></returns>
/// <example>
/// <returns>Paneelien lukumäärä.</returns>
/// <example>
/// <pre name="test">
/// Paneleita(5, 3, 100, 4) ~~~ 38
/// Paneleita(5.4, 2.6, 98, 5,4) ~~~ 27
/// Paneleita(5.4, 2.6, 98, 5.4) ~~~ 27
/// Paneleita(5, 3, 98, 4) ~~~ 39
/// </pre>
/// </example>
......@@ -85,6 +91,7 @@ public class HarmjosaHT
return kokonaisiapaneleita;
}
/// <summary>
/// Aliohjelma laskee edellisen aliohjelman tuloksen perusteella ostettavien paneleiden hinnan.
/// Hinta pyöristetään sentin tarkkuuteen.
......@@ -94,7 +101,6 @@ public class HarmjosaHT
/// <param name="e">Panelin metrihinta</param>
/// <returns>Ostoksen hinta</returns>
/// <example>
/// <example>
/// <pre name="test">
/// Hinta(26, 4.80, 2.45) ~~~ 305.76
/// </pre>
......
// ReSharper disable all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using static HarmjosaHT;
[TestFixture]
[DefaultFloatingPointTolerance(0.000001)]
public class TestHarmjosaHT
{
[Test]
public void TestPaneleita80()
{
Assert.AreEqual( 38, Paneleita(5, 3, 100, 4) , 0.000001, "in method Paneleita, line 81");
Assert.AreEqual( 27, Paneleita(5.4, 2.6, 98, 5.4) , 0.000001, "in method Paneleita, line 82");
Assert.AreEqual( 39, Paneleita(5, 3, 98, 4) , 0.000001, "in method Paneleita, line 83");
}
[Test]
public void TestHinta104()
{
Assert.AreEqual( 305.76, Hinta(26, 4.80, 2.45) , 0.000001, "in method Hinta, line 105");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.1"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../HarmjosaHT/HarmjosaHT.csproj"/>
</ItemGroup>
</Project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment