﻿/*
Veidoja: Fedosova Elizaveta
Grupa: 110
Praktiskais darbs 6.2
Izmantotais Compiler: www.onlinegdb.com
*/

using System;

namespace PR62
{
class Program
{
//Skaitļa zīmes noteikšana
static void Zime()
{
Console.WriteLine("Ievadiet skaitli: ");
int x = Convert.ToInt32(Console.ReadLine());
if(x < 0){
Console.WriteLine("Skaitlis ir negatīvs");
}
else if(x > 0){
Console.WriteLine("Skaitlis ir pozitīvs");
}
else{
Console.WriteLine("Skaitlis ir nulle");
}
}

//Nedēļas dienas vārds
static void Nedelas()
{
Console.WriteLine("Ievadiet nedeļas dienas numuru: ");
int d = Convert.ToInt32(Console.ReadLine());
string diena = "Nepareizs skaitlis!";

switch(d)
{
case 1:
diena = "Pirmdiena";
break;
case 2:
diena = "Otrdiena";
break;
case 3:
diena = "Trešdiena";
break;
case 4:
diena = "Ceturtdiena";
break;
case 5:
diena = "Piektdiena";
break;
case 6:
diena = "Sestdiena";
break;
case 7:
diena = "Svētdiena";
break;
default:
diena = "Nepareizs skaitlis!";
break;
}
Console.WriteLine(diena);
}

//Atzīmju kalkulators
static void Atzimes()
{
Console.WriteLine("Ievadiet iegūto punktu skaitu: ");
int p = Convert.ToInt32(Console.ReadLine());
string atz = "";

if (100 >= p && p >= 90) {
atz = "A";
}
else if (89 >= p && p >= 80) { //jā būtu if, tad programma pārrakstīs iepriekšējo if
atz = "B";
}
else if (79 >= p && p >= 70) {
atz = "C";
}
else if (69 >= p && p >= 60) {
atz = "D";
}
else if (59 >= p && p >= 50) {
atz = "E";
}
else if (49 >= p && p >= 0) {
atz = "F";
}
else {
atz = "Kļūda";
}
Console.WriteLine($"Atzīme ir {atz}");
}

//Kalkulators
static void Kalkulators(){
Console.WriteLine("Ievadiet pirma skaitļa vērtību: ");
int A = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Ievadiet otra skaitļa vērtību: ");
int B = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Ievadiet darbības simbolu: ");
char darb = Convert.ToChar(Console.ReadLine());

switch(darb){
case '+':
int rez = A + B;
Console.WriteLine(rez);
break;
case '-':
rez = A - B;
Console.WriteLine(rez);
break;
case '*':
rez = A * B;
Console.WriteLine(rez);
break;
case '/':
if(B == 0) {Console.WriteLine("Kļūda");}
else {
rez = A / B;
Console.WriteLine(rez);
}
break;
default:
Console.WriteLine("Kļūda");
break;
}
}
//Garais gads
static void Gads()
{
Console.WriteLine("Ievadiet gadu: ");
int g = Convert.ToInt32(Console.ReadLine());
if(g % 4 == 0 && g % 100 != 0 || g % 400 == 0){
Console.WriteLine($"{g} ir garais gads");
}
else {
Console.WriteLine($"{g} ir īsais gads");
}
}

//Biļešu atlaides sistēma
static void Atlaides()
{
Console.WriteLine("Ievadiet vecumu: ");
int vec = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Ir students? (ir/nav) ");
string stud = Convert.ToString(Console.ReadLine());
bool irStudents = false;
if (stud == "ir"){
irStudents = true;
}
else if (stud == "nav"){
irStudents = false;
}
else {
Console.WriteLine("Kļūda");
}

int atl = 0;
double cena = 10.00;


if(vec < 6){
atl = 0;
cena = 0.00;
}

if(6 < vec || 6 == vec && vec < 17 || vec == 17) {
atl = 50;
cena = 5.00;
}

if(18 < vec || 18 == vec && vec < 25 || vec == 25 && irStudents == true) {
atl = 25;
cena = 7.50;
}

Console.WriteLine($"Cena: ${cena}");
Console.WriteLine($"Atlaide: {atl}%");
}

static void Main(string[] args)
{
Zime();
Nedelas();
Atzimes();
Kalkulators();
Gads();
Atlaides();
}
}
}