Miles per gallon to kilometers per liter
Miles per gallon to kilometers per liter
1 Imperial Gallon = 4.54609188 litres
1 Mile = 1.609344 kilometres
1英制加仑=4.54609188升
1英里=1.609344千米
mpg=每加仑行驶的英里数(miles per gallon)
Description:
Sometimes, I want to quickly be able to convert miles per gallon into kilometers per liter.
Create an application that will display the number of kilometers per liter (output) based on the number of miles per gallon (input).
Make sure to round off the result to two decimal points.
Some useful associations relevant to this kata: 1 Imperial Gallon = 4.54609188 litres 1 Mile = 1.609344 kilometres
using System;
public static class Kata
{
public static double Converter(int mpg)
{
// do your magic
double kpl = mpg * 1.609344 / 4.54609188;
return Math.Round(kpl,);
}
}
Miles per gallon to kilometers per liter的更多相关文章
- c++ primer plus 第三章 课后题答案
#include<iostream> using namespace std; int main() { ; int shen_gao; cout <<"Please ...
- C Primer Plus(第五版)12
第 12 章 存储类, 链接和内存管理 在本章中你将学习下列内容 . 关键字: auto, extern, static, register, const, volatile, restricted. ...
- c++-pimer-plus-6th-chapter03
Chapter Review Having more than one integer type lets you choose the type that is best suited to a p ...
- ArcGIS Server开发教程系列(8)ArcGIS API for Javascript-控件(小部件)
1. 鹰眼 OverviewMap小部件用于在其关联的主地图内较清楚的当前鸟瞰图的范围.当主地图范围变化时,鹰眼图会自动在其空间内更新范围以保持和地图的当前范围保持一致,当鹰眼图空间的地图范围 ...
- R语言实战(一)介绍、数据集与图形初阶
本文对应<R语言实战>前3章,因为里面大部分内容已经比较熟悉,所以在这里只是起一个索引的作用. 第1章 R语言介绍 获取帮助函数 help(), ? 查看函数帮助 exampl ...
- 深入浅出Symfony2 - 结合MongoDB开发LBS应用
简介 随着近几年各类移动终端的迅速普及,基于地理位置的服务(LBS)和相关应用也越来越多,而支撑这些应用的最基础技术之一,就是基于地理位置信息的处理.我所在的项目也正从事相关系统的开发,我们使用的是S ...
- Scatterplots 散点图
Simple Scatterplot # Simple Scatterplot attach(mtcars)plot(wt, mpg, main="Scatterplot Example&q ...
- ArcGIS Server 开发之鹰眼地图的实现
鹰眼简单点说就是地图的联动,鹰眼的全称是OverviewMap,在ERSI提供的API包中,在dijit中进行类的调用.查了很多的资料,总结一下: 具体的代码: <!DOCTYPE html&g ...
- R 绘图 填充颜色
d <- density(mtcars$mpg) plot(d, main="Kernel Density of Miles Per Gallon") polygon(d, ...
随机推荐
- Jquery实现手机上下滑屏滑动的特效代码
要引入两个jquery插件 可以去网上下载 <script src="jquery-1.11.1.min.js"></script><script s ...
- ajaxFileUpload - Post file and data together
jQuery.extend({ createUploadIframe: function(id, uri) { //create frame var frameId = 'jUploadFrame' ...
- nginx 重启命令
#重启nginx sudo /etc/init.d/nginx restart sudo /etc/init.d/nginx Usage: /etc/init.d/nginx {start|stop| ...
- 获取股票历史数据和当前数据的API
关键字:股票,stock,API,接口 1.获取股票当前数据 新浪数据接口:http://hq.sinajs.cn/list={code}.{code}替换为股票代码,沪市股票代码加前缀sh,深市股票 ...
- 免信用卡注册美国App Store账号
对于一些应用国内的App Store无法下载让人很郁闷,而自己又有点轻微的强迫症.于是开始尝试免信用卡注册iCloud账号. Apple的官方网站上的教程,见http://support.apple. ...
- 1043. Is It a Binary Search Tree
http://www.patest.cn/contests/pat-a-practise/1043 #include <stdio.h> #include <vector> u ...
- HTML 菜单 a 标签设置样式
html: "<div style='font-weight:800;color:red'> <a href='javascript:void(0)'style='colo ...
- 判断webpart类型 How can I tell what type a web part is?
using(new SPSite("http://mysite/myweb").OpenWeb()){ //give relative path of the webpartpag ...
- mysql 跨库JOIN
现有两台MYSQL数据库 一台是192.168.1.1 端口3306 上有数据库DB1 有表TABLE1一台是192.168.1.2 端口3307 上有数据库DB2 有表TABLE2192.168.1 ...
- 【数学】[BZOJ 3884] 上帝与集合的正确用法
Description 根据一些书上的记载,上帝的一次失败的创世经历是这样的: 第一天, 上帝创造了一个世界的基本元素,称做“元”. 第二天, 上帝创造了一个新的元素,称作“α”.“α”被定义为“元” ...