แบบฝึกหัด - ทําการทดสอบให้เสร็จสมบูรณ์เพื่อใช้การแปลงสตริงกับตัวอักษรของฟอร์ม

เสร็จสมบูรณ์เมื่อ

สําหรับผลิตภัณฑ์การลงทุนใหม่ล่าสุดของบริษัทขายและการตลาดคุณส่งจดหมายส่วนบุคคลหลายพันฉบับให้กับลูกค้าที่มีอยู่ของบริษัท งานของคุณคือการเขียนรหัส 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 Editor

  2. ในรหัส Visual Studio ให้เพิ่มรหัสต่อไปนี้เพื่อรับข้อมูลสําหรับการทดสอบ:

    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 Editor เพื่อสร้างข้อความขณะใช้ตัวแปรและโค้ดที่กําหนด

    คุณไม่สามารถลบรหัสที่มีอยู่ยกเว้นข้อคิดเห็น

  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  
    

โชคดี!

ไม่ว่าคุณจะติดอยู่และต้องการดูที่โซลูชัน หรือคุณทําเสร็จแล้ว ดําเนินการต่อเพื่อดูโซลูชันสําหรับการทดสอบนี้