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. 如何建立一个“绑定友好的”usercontrol--wpf

    如何建立一个"绑定友好的"usercontrol--wpf 这几天在打算将以前用winform写的工具程序重构到wpf,顺便学习理解看过的wpf的知识. 因为程序设计到一个Exce ...

  2. PHP中刷新输出缓冲,立即输出数据

    <script type="text/javascript"> function show_message(message) { document.getElement ...

  3. delphi调用 java 的 WebService服务端.

    // InvRegistry.RegisterInvokeOptions(TypeInfo(ModelADServicePortType), ioLiteral); InvRegistry.Regis ...

  4. linux 输入子系统(1)----系统概述

    输入设备的工作中,只是中断.读键值/坐标值是设备相关的,而输入事件的缓冲区管理以及字符设备驱动的file_operations接口则对输入设备是通用的,基于此,内核设计了input输入子系统,由核心层 ...

  5. PythonCrawl自学日志(3)

    2016年9月21日09:21:431.爬虫的抓取周期:(1)首先生成初始请求爬第一个url,并指定一个回调函数被称为与下载这些请求的响应.(2)第一个请求执行通过调用 start_requests( ...

  6. fedora 20 PIL

    今天安装PIL花了我好多的时间. 刚开始,我手动下载PIL原码,编译安装. 启动我的django项目,报下面的错误,完全不懂是么意思. CommandError: One or more models ...

  7. jsf2.0视频

    jsf2.0 入门视频 教程   需要的看下.初次录视频.还有很多需要完善. JSF交流QQ群84376982 JSF入门视频下载地址  http://pan.baidu.com/s/1jG3y4T4 ...

  8. qwt 6.1.0集成进Qt creator 2.8.1步骤

    环境准备与文件编译 ·关于Qt 发现一个Qt正确安装的教程,非常棒!http://www.wikihow.com/Install-Qt-SDK-on-Ubuntu-Linux Qt版本是4.8.5,在 ...

  9. mybatis--面向接口编程

    如果使用hiberante作为dao层,常用的方式是:定义一个dao层接口包(com.dao.service)然后在定义一个dao层接口实现包(com.dao.service.impl),这样定义结构 ...

  10. 【高斯消元】Poj 1222:EXTENDED LIGHTS OUT

    Description In an extended version of the game Lights Out, is a puzzle with 5 rows of 6 buttons each ...