- Advanced TypeScript Programming Projects
- Peter O'Hanlon
- 230字
- 2021-06-24 13:27:08
Questions
- We have written an application that allows users to convert from Fahrenheit into Celsius and from Celsius into Fahrenheit. The calculations are performed in the following classes:
class FahrenheitToCelsius {
Convert(temperature : number) : number {
return (temperature - 32) * 5 / 9;
}
}
class CelsiusToFahrenheit {
Convert(temperature : number) : number {
return (temperature * 9/5) + 32;
}
}
We want to write a method that accepts a temperature and an instance of either of these types, which will then perform the relevant calculation. What technique would we use to write this method?
- We have written the following class:
class Command {
public constructor(public Name : string = "", public Action : Function = new Function()){}
}
We want to use this in another class where we will add a number of commands. Name of the command is going to be the key that we can use to look up Command later on in our code. What would we use to provide this key-value functionality and how would we add records to it?
- How would we automatically log that we were adding entries to the command we added in Question 2 without adding any code inside our Add methods?
- We have created a Bootstrap web page where we want to display a row with six medium columns of equal size. How would we do this?
推薦閱讀
- Modern Web Testing with TestCafe
- Implementing Cisco UCS Solutions
- 阿里云數(shù)字新基建系列:云原生操作系統(tǒng)Kubernetes
- Hands-On DevOps with Vagrant
- 嵌入式應(yīng)用程序設(shè)計(jì)綜合教程(微課版)
- SharePoint 2013 應(yīng)用開發(fā)實(shí)戰(zhàn)
- Linux網(wǎng)絡(luò)內(nèi)核分析與開發(fā)
- Moodle 3.x Teaching Techniques(Third Edition)
- Linux使用和管理指南:從云原生到可觀測(cè)性
- Ceph分布式存儲(chǔ)實(shí)戰(zhàn)
- 注冊(cè)表應(yīng)用完全DIY
- Django Project Blueprints
- 精解Windows 10
- μC/OS-III內(nèi)核實(shí)現(xiàn)與應(yīng)用開發(fā)實(shí)戰(zhàn)指南:基于STM32
- 大學(xué)計(jì)算機(jī)應(yīng)用基礎(chǔ)實(shí)踐教程(Windows 7+MS Office 2010)