תרגיל - השלם אתגר להחלת אינטרפולציה של מחרוזות על מכתב אחיד
עבור מוצרי ההשקעות החדשים ביותר של חברת המכירות והשיווק, אתה שולח אלפי מכתבים מותאמים אישית ללקוחות הקיימים של החברה. תפקידך הוא לכתוב קוד 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#.
בחר ומחק את כל שורות הקוד בעורך הקוד של Visual Studio.
ב- 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);השתמש בעורך קוד Visual Studio כדי ליצור את ההודעה בעת שימוש במשתנים ובקוד הנתונים.
אינך רשאי למחוק אף אחד מהקוד הקיים למעט ההערות.
ודא שהקוד שלך יפלט את ההודעה הבאה:
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
בהצלחה!
בין אם אתה נתקע ועליך להציץ בפתרון או שאתה מסיים בהצלחה, המשך להציג פתרון לאתגר זה.