Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _5.Note_Statistics
- {
- public class MusicMakesUsFree
- {
- public static void Main()
- {
- var chordBook = Console.ReadLine().Split(' ').ToList();
- double naturalSum = 0;
- double sharpsSum = 0;
- List<string> notes = new List<string>();
- List<string> naturals = new List<string>();
- List<string> sharps = new List<string>();
- foreach (var chord in chordBook)
- {
- switch (chord)
- {
- case "261.63":
- naturalSum += 261.63;
- naturals.Add("C");
- notes.Add("C");
- break;
- case "277.18":
- sharpsSum += 277.18;
- sharps.Add("C#");
- notes.Add("C#");
- break;
- case "293.66":
- naturalSum += 293.66;
- naturals.Add("D");
- notes.Add("D");
- break;
- case "311.13":
- sharpsSum += 311.13;
- sharps.Add("D#");
- notes.Add("D#");
- break;
- case "329.63":
- naturalSum += 329.63;
- naturals.Add("E");
- notes.Add("E");
- break;
- case "349.23":
- naturalSum += 349.23;
- naturals.Add("F");
- notes.Add("F");
- break;
- case "369.99":
- sharpsSum += 369.99;
- sharps.Add("F#");
- notes.Add("F#");
- break;
- case "392.0":
- naturalSum += 392.00;
- naturals.Add("G");
- notes.Add("G");
- break;
- case "415.3":
- sharpsSum += 415.30;
- sharps.Add("G#");
- notes.Add("G#");
- break;
- case "440.0":
- naturalSum += 440.00;
- naturals.Add("A");
- notes.Add("A");
- break;
- case "466.16":
- sharpsSum += 466.16;
- sharps.Add("A#");
- notes.Add("A#");
- break;
- case "493.88":
- naturalSum += 493.88;
- naturals.Add("B");
- notes.Add("B");
- break;
- default:
- break;
- }
- }
- Console.WriteLine($"Notes: {string.Join(" ",notes)}");
- Console.WriteLine($"Naturals: {string.Join(", ", naturals)}");
- Console.WriteLine($"Sharps: {string.Join(", ", sharps)}");
- Console.WriteLine($"Naturals sum: {naturalSum}");
- Console.WriteLine($"Sharps sum: {sharpsSum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement