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, ...
随机推荐
- SQL Server如何使用XML格式传输解析
Sqlserver in 实现 参数化查询 XML类型解决方案 [转] :如果参数是int类型: declare @a xml set @a=' <row><id>1</ ...
- 解析php file_exists无效的解决办法
php中file_exists无效的解决办法. 方法1 :据官方手册上描述若php教程的safe mode相关的设置过于苛刻,就会出现这样的情形:尽管文件真实存在也被误报,认为文件不存在. 由于服务器 ...
- CentOS6.5下 yum安装LAMP
CentOS下yum安装LAMP 1. 用yum安装Apache,Mysql,PHP. 1.1安装Apache yum install httpd httpd-devel 安装完成后,用/etc/ ...
- 1056. Mice and Rice (25)
时间限制 30 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Mice and Rice is the name of a pr ...
- Linux命令执行顺序— ||和&&和;
command1 && command2: &&左边的command1执行成功(返回0表示成功)后,&&右边的command2才能被执行. comman ...
- 【BZOJ1500】[NOI2005]维修数列
Description Input 输入的第1 行包含两个数N 和M(M ≤20 000),N 表示初始时数列中数的个数,M表示要进行的操作数目.第2行包含N个数字,描述初始时的数列.以下M行,每行一 ...
- ios登陆界面
代码较老,仅供参考 主要涉及的功能点有: 1.密码输入框要隐藏输入字符,以黑点代替,有时候会在边上设置一个按钮,让用户选择是否需要密文输入 2.Login时会检查输入框,若输入不合法,弹窗提示用户 3 ...
- 4.2 spring-import 标签的解析;
对于spring配置文件的编写,我想,对于经历过庞大项目的人,都有那种恐惧的心理,太多的配置文件.不过,分模块都是大多数人能想到的方法,但是,怎么分模块,那就是仁者见仁,智者见智了.我的策略是使用im ...
- SpringJUnit4加载类目录下(src)和WEF-INF目录下的配置文件
路径说明: 一.加载类目录下的配置文件 @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:ap ...
- 现代浏览器原生js获取id号方法
<div id="tests" class="a b c" style="color:#f00">123</div> ...