HW2.4

 1 import java.util.Scanner;
 2
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         final double POUND_TO_KILOGRAM = 0.454;
 8
 9         Scanner input = new Scanner(System.in);
10
11         System.out.print("Enter a number in pounds: ");
12         double pounds = input.nextDouble();
13         double kilogram = pounds * POUND_TO_KILOGRAM;
14
15         System.out.println(pounds + " pounds is " + kilogram + " kilograms");
16
17         input.close();
18     }
19 }
时间: 2024-11-09 03:20:07

HW2.4的相关文章

HW2.23

1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 9 System.out.print("Enter v0, v1 and t: "); 10 double v0 = input.nextDouble(); 11 double v1 = inpu

机器学习及其matlab实现—从基础到实践——HW2

Contents 读取外部数据文件(文件格式不限,mat.txt.xls.csv等均可) 绘制图形(包含xlabel.ylabel.title.legend,并对字体和线性进行设置) 读取外部数据文件(文件格式不限,mat.txt.xls.csv等均可) 1. mat格式 load data.mat 2. txt格式 M = importdata('data.txt'); 3. xls格式 W = xlsread('data.xls'); 4. csv格式 V = csvread('data.c

hw2

代码如下: 1)Date(String s)那块我注释出来的那一块,把for语句里改成j<s.length()也可以运行出来. 2)想问一下大家是怎么想到用match和split的方法的? 3)difference那块可以用下面两句改写,很巧妙. else if (isBefore(d)) 133 return -d.difference(this); 4)作业做了很久,但真的有对之前lecture没懂的地方有了更多的认识 package homework2; /* Date.java */ i

HW2.25

1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 System.out.print("Enter the time zone offset to GMT: "); 9 int offset = input.nextInt(); 10 11 inp

HW2.24

1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 9 System.out.print("Enter v and a: "); 10 double v = input.nextDouble(); 11 double a = input.nextD

软件测试hw2 描述日常project

做西红柿炒鸡蛋 本质是做饭 预计用时10分钟,实际用时10分钟 资源: 原始材料包括西红柿.鸡蛋.葱花.盐.糖 消耗金钱6块 工具:锅,碗,铲子,筷子,碟子 人工:自己做饭就不要钱了 过程: 用锅热油,并将油均匀过一遍锅. 将鸡蛋打开加入少许盐 鸡蛋炒开后盛入碗中备用 重新加入少许油,放入葱花炝锅 葱花炒出香味后加入切成块的西红柿,炒出汁后将鸡蛋放入 稍微放入一些糖去除酸味 盛盘 结果:一盘西红柿炒鸡蛋

HW2.20

1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 9 System.out.print("Enter x1 and y1: "); 10 double x1 = input.nextDouble(); 11 double y1 = input.n

HW2.19

1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 char outcome; 6 long randomNumber; 7 8 while(true) 9 { 10 randomNumber = System.currentTimeMillis() % 91; 11 if(randomNumber >= 65 && randomNumber <= 90) 12 break; 13

Software Testing hw2

Fault的定义:可能导致系统或功能失效的异常条件(Abnormal condition that can cause an element or an item tofail.),可译为“故障”. Error的定义:计算.观察或测量值或条件,与真实.规定或理论上正确的值或条件之间的差异(Discrepancy between a computed, observed or measured value or condition and the true, specified, or theor

HW2.22

1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 9 System.out.print("Enter the side: "); 10 double side = input.nextDouble(); 11 12 input.close();