연습 - 양식 문자에 문자열 보간을 적용하는 과제 완료

완료됨

영업 및 마케팅 회사의 최신 투자 제품의 경우 수천 개의 개인 설정된 편지를 회사의 기존 고객에게 보냅니다. C# 코드를 작성하여 고객에 대한 개인 설정된 정보를 병합하는 작업을 수행합니다. 이 편지에는 기존 포트폴리오와 같은 정보가 포함되어 있으며, 신제품 사용에 투자할 경우 현재 수익률을 예상 수익률과 비교합니다.

작성자가 다음 마케팅 메시지 예제를 결정했습니다. 다음은 원하는 출력입니다(가상의 고객 계정 데이터 사용).

Dear Ms. Barros,
As a customer of our Magic Yield offering we are excited to tell you about a new financial product that would dramatically increase your return.

Currently, you own 2,975,000.00 shares at a return of 12.75%.

Our new product, Glorious Future offers a return of 13.13%.  Given your current volume, your potential profit would be ¤63,000,000.00.

Here's a quick comparison:

Magic Yield         12.75%   $55,000,000.00      
Glorious Future     13.13%   $63,000,000.00  

문자열 서식 지정에 대한 새로운 지식을 사용하여 이전 예제 출력에서 적절한 콘텐츠를 병합하고 서식을 지정할 수 있는 애플리케이션을 빌드합니다. 공백에 특히 주의를 기울이고 C#을 사용하여 이 정확한 형식을 정확하게 나타내야 합니다.

  1. Visual Studio Code 편집기에서 모든 코드 줄을 선택하고 삭제합니다.

  2. Visual Studio Code에서 다음 코드를 추가하여 과제를 위한 데이터를 가져옵니다.

    string customerName = "Ms. Barros";
    
    string currentProduct = "Magic Yield";
    int currentShares = 2975000;
    decimal currentReturn = 0.1275m;
    decimal currentProfit = 55000000.0m;
    
    string newProduct = "Glorious Future";
    decimal newReturn = 0.13125m;
    decimal newProfit = 63000000.0m;
    
    // Your logic here
    
    Console.WriteLine("Here's a quick comparison:\n");
    
    string comparisonMessage = "";
    
    // Your logic here
    
    Console.WriteLine(comparisonMessage);
    
  3. Visual Studio Code 편집기를 사용하여 지정된 변수와 코드를 사용하는 동안 메시지를 생성합니다.

    주석을 제외한 기존 코드는 삭제할 수 없습니다.

  4. 코드가 다음 메시지를 출력하는지 확인합니다.

    Dear Ms. Barros,
    As a customer of our Magic Yield offering we are excited to tell you about a new financial product that would dramatically increase your return.
    
    Currently, you own 2,975,000.00 shares at a return of 12.75%.
    
    Our new product, Glorious Future offers a return of 13.13%.  Given your current volume, your potential profit would be $63,000,000.00.
    
    Here's a quick comparison:
    
    Magic Yield         12.75%   $55,000,000.00      
    Glorious Future     13.13%   $63,000,000.00  
    

행운을 빌어!

진행이 막혀서 솔루션을 참고할 필요가 있거나 성공적으로 완료했다면 계속 진행하여 이 과제에 대한 솔루션을 확인하세요.