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的更多相关文章

  1. c++ primer plus 第三章 课后题答案

    #include<iostream> using namespace std; int main() { ; int shen_gao; cout <<"Please ...

  2. C Primer Plus(第五版)12

    第 12 章 存储类, 链接和内存管理 在本章中你将学习下列内容 . 关键字: auto, extern, static, register, const, volatile, restricted. ...

  3. 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 ...

  4. ArcGIS Server开发教程系列(8)ArcGIS API for Javascript-控件(小部件)

    1.     鹰眼 OverviewMap小部件用于在其关联的主地图内较清楚的当前鸟瞰图的范围.当主地图范围变化时,鹰眼图会自动在其空间内更新范围以保持和地图的当前范围保持一致,当鹰眼图空间的地图范围 ...

  5. R语言实战(一)介绍、数据集与图形初阶

    本文对应<R语言实战>前3章,因为里面大部分内容已经比较熟悉,所以在这里只是起一个索引的作用. 第1章       R语言介绍 获取帮助函数 help(), ? 查看函数帮助 exampl ...

  6. 深入浅出Symfony2 - 结合MongoDB开发LBS应用

    简介 随着近几年各类移动终端的迅速普及,基于地理位置的服务(LBS)和相关应用也越来越多,而支撑这些应用的最基础技术之一,就是基于地理位置信息的处理.我所在的项目也正从事相关系统的开发,我们使用的是S ...

  7. Scatterplots 散点图

    Simple Scatterplot # Simple Scatterplot attach(mtcars)plot(wt, mpg, main="Scatterplot Example&q ...

  8. ArcGIS Server 开发之鹰眼地图的实现

    鹰眼简单点说就是地图的联动,鹰眼的全称是OverviewMap,在ERSI提供的API包中,在dijit中进行类的调用.查了很多的资料,总结一下: 具体的代码: <!DOCTYPE html&g ...

  9. R 绘图 填充颜色

    d <- density(mtcars$mpg) plot(d, main="Kernel Density of Miles Per Gallon") polygon(d, ...

随机推荐

  1. DWZ 刷新 dialog

    DWZ刷新dialog: 1,在删除按钮上添加callback属性;如:(callback="dialogAjax") <a class="delImg" ...

  2. 利用input事件来监听移动端的输入

    今天遇到一个新需求,经理要求评论功能需要限制字数,就像微博那样限制最多输入150字,这里就需要实时提醒用户还能输入多少字了. 在最开始的时候,想到的是监听keyup事件,然后计算用户输入的字数,但是有 ...

  3. Android 核心组件 Activity 之下

    创建新的Activity的方式: 1. 在相应的文件下 Ctrl + N  (Eclipse, Android中不知道是不是) 2. 创建类,继承自Activity或者Activity的子孙类, 并在 ...

  4. python(六)面向对象

    1.封装 支持多重继承,但如果不需要的时候最好不要使用,避免出现不必要的bug: 2.继承 3.多态 4.构造函数 5.私有和共有 在属性前写两个下滑线定义就是私有的

  5. Implement Custom Cache Dependencies in ASP.NET 1.x

    Code download available at:CuttingEdge0407.exe(128 KB)   Contents What's a Cache Dependency, Anyway? ...

  6. Kinetic使用注意点--circle

    new Circle(config) 参数: config:包含所有配置项的对象. { radius: "半径", fill: "填充色", fillRGB: ...

  7. RegisterClientScriptBlock CommandName 模块列 操作完成 提示

    this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Remind", "alert('获取成功!') ...

  8. DB天气app冲刺第十一天

    今天是第十一天了.今天遇到了一个很麻烦的问题 就是程序好好的然后调试运行之后能够安装成功 但总是运行不了 一直闪退.最主要的问题是代码还没有问题,这是最让人揪心的一个问题了.因为有bug的话还可以改, ...

  9. 域名的a记录转过来他的公网ip

    首先 客户要我把域名 和项目进行绑定客户需要提供万网或者新网的账户,登进去域名管理  选项域名管理的A记录定向到那个公网ip上 与服务器做绑定然后 在服务器的iis 上 加个主机头 输入主机头名称 也 ...

  10. poj 3249 Test for Job (记忆化深搜)

    http://poj.org/problem?id=3249 Test for Job Time Limit: 5000MS   Memory Limit: 65536K Total Submissi ...