Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Exercise 2/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

namespace Exercise_2
{
class Program
{
static void Main(string[] args)
{

Console.Write("Skriv in ett decimial tal: ");
double userInput = Convert.ToDouble(Console.ReadLine());

int rounded = (int)Math.Round(userInput, 0);

Console.WriteLine("Svaret blir: " + rounded);


}
}
}
30 changes: 30 additions & 0 deletions Metoder-Exercise4/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;

namespace Metoder_Exercise4
{
class Program
{
static void Main(string[] args)
{
Console.Write("Skriv ett pris: ");

int userInput = Convert.ToInt32(Console.ReadLine());
Copy link
Contributor

@lyret lyret Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tänk på att det kan vara enklare att felsöka sin kod om man delar upp varje funktionsanrop på en egen rad

Suggested change
int userInput = Convert.ToInt32(Console.ReadLine());
string userConsoleInput = Console.ReadLine();
int userInput = Convert.ToInt32(userConsoleInput);


CountMoms(userInput);


}

static void CountMoms(int value)
{
const double moms = 0.25;

double medMoms = value * (moms + 1);
double utanMoms = value * moms;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Är verkligen value * moms samma som värdet utan moms?


Console.WriteLine("Momsen är: " + utanMoms);
Console.WriteLine("Priset med moms blir: " + medMoms);

}
}
}