MuffinMonster

Class Task 12#

Oct 13th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 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 ConsoleApplication5
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int hours, payment, totalpay = 0, temp, x = 0;
  14.             Console.Write("Enter hours: ");
  15.             hours = int.Parse(Console.ReadLine());
  16.             Console.Write("Payment: ");
  17.             payment = int.Parse(Console.ReadLine());
  18.             while (payment != -999 && hours != -999)
  19.             {
  20.                 temp = payment * hours;
  21.                 if (hours > 150)
  22.                     temp += 250;
  23.                 totalpay = totalpay + temp;
  24.                 x++;
  25.                 Console.Write("Enter hours: ");
  26.                 hours = int.Parse(Console.ReadLine());
  27.                 Console.Write("Payment: ");
  28.                 payment = int.Parse(Console.ReadLine());
  29.             }
  30.             Console.WriteLine("Total payment was: " + totalpay);
  31.             Console.WriteLine("Memuza: " + (totalpay/x));
  32.             Console.ReadKey();
  33.         }
  34.     }
  35. }
Add Comment
Please, Sign In to add comment