Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Example
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Black and white or colour printing: ");
- string printing = Console.ReadLine();
- Console.Write("Number of books: ");
- int numberOfBooks = int.Parse(Console.ReadLine());
- Console.Write("Pages: ");
- int pages = int.Parse(Console.ReadLine());
- double grandTotal = 0;
- switch (printing)
- {
- case "black and white":
- grandTotal = blackAndWhite(numberOfBooks, pages);
- break;
- case "colour":
- grandTotal = colourful(numberOfBooks, pages);
- break;
- }
- Console.WriteLine($"Grand Total: {grandTotal:f2}");
- }
- public static double blackAndWhite(int numberOfBooks, int pages)
- {
- double priceForASheet = 0.01;
- int plate = 7;
- int priceForBinding = 2;
- double subtotal = (pages * plate) + ((pages / 2) * numberOfBooks) * priceForASheet + numberOfBooks * priceForBinding;
- double vat = subtotal * 0.175;
- double grandTotal = subtotal + vat;
- return grandTotal;
- }
- public static double colourful(int numberOfBooks, int pages)
- {
- double priceForASheet = 0.04;
- double plate = 28;
- double priceForBinding = 2;
- double subtotal = (pages * plate) + ((pages / 2) * numberOfBooks) * priceForASheet + numberOfBooks * priceForBinding;
- double vat = subtotal * 0.175;
- double grandTotal = subtotal + vat;
- return grandTotal;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment