Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace teht57
  8. {
  9.     class Program
  10.     {
  11.         static void Ylioppilasarvosana(int pisteet)
  12.         {
  13.             if (pisteet > 60)
  14.             {
  15.                 throw new ArgumentException("Et voi saada yli 60 pistettä!");
  16.             }
  17.             else if (pisteet < 0)
  18.             {
  19.                 throw new ArgumentException("Alle 0 pistettä on mahdottomuus!");
  20.             }
  21.             else if (pisteet < 10)
  22.             {
  23.                 Console.WriteLine("Arvosanasi on: hylätty");
  24.             }
  25.             else if(pisteet >= 10 && pisteet < 16)
  26.             {
  27.                 Console.WriteLine("Arvosanasi on: A");
  28.             }
  29.             else if (pisteet >= 16 && pisteet < 23)
  30.             {
  31.                 Console.WriteLine("Arvosanasi on: B");
  32.             }
  33.             else if (pisteet >= 23 && pisteet < 32)
  34.             {
  35.                 Console.WriteLine("Arvosanasi on: C");
  36.             }
  37.             else if (pisteet >= 32 && pisteet < 45)
  38.             {
  39.                 Console.WriteLine("Arvosanasi on: M");
  40.             }
  41.             else if (pisteet >= 45 && pisteet < 58)
  42.             {
  43.                 Console.WriteLine("Arvosanasi on: E");
  44.             }
  45.             else if (pisteet >= 58)
  46.             {
  47.                 Console.WriteLine("Arvosanasi on: L");
  48.             }
  49.         }
  50.         static void Main(string[] args)
  51.         {
  52.             Console.WriteLine("Mikä oli matematiikan kirjoitusten pistemääräsi?");
  53.             string syote = Console.ReadLine();
  54.             int syoteInt = Int32.Parse(syote);
  55.             Ylioppilasarvosana(syoteInt);
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement