JAVA基础课后练习

P63页第2.3题

package cn.edu.www;

import java.util.Scanner;

public class YingChiJiSuan {

    public static void main(String[] args) {               

        Scanner input = new Scanner(System.in);

        System.out.println("Enter a value for feet:");

        double d = input.nextDouble();

        double valueForFeet = d * 100;

        System.out.println("valueforfeet is " + valueForFeet + "In ValueForFeet");

    }

}

P64页2.4题

package cn.edu.www;

import java.util.Scanner;

public class BangKeShu {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

System.out.println("Enter a number of pound:");

double a = input.nextDouble();

double NumberOfPound= 0.454*a;

System.out.println("NumberOfPound is" + NumberOfPound +"inNumberOfPound");

    }

}

P64页2.5题

package cn.edu.www;

import java.util.Scanner;

public class XiaoFei {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        System.out.println("Enter a number of expenditure");

        double expenditure = input.nextDouble();

        double tip =  expenditure * 0.15;

        System.out.println("tip" + tip + "tip");

        double amount =  expenditure + tip;

    System.out.println("amount is " + amount + "in amount");

       

    }

}

第64页2.6题

    package cn.edu.www;

import java.util.Scanner;

public class NumBer {

//此题完成了一半;

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        int y = 932;

        int z = 14;

        int x1 = y %10;

        System.out.println("Enter a number  0 and 1000 e.g. :");

        double a = input.nextDouble();

        double Number = a-y;

       

       

        System.out.println("x1 is" + x1 + "in x1");

        System.out.println("number is" + Number +"in number" );

            }

}

第64页第2.7题

package cn.edu.www;

import java.util.Scanner;

public class TiMe {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        System.out.println("Enter the number of minutes e.g.10,0000,0000:");

        double NumberOfMintues = input.nextDouble();

        double year = 365;

        double day = 24;

        double Second = 60;

        //365*24*60=525600;

        double a = year * day * Second;

        //1000000000/525600;

        double b = NumberOfMintues / a;

        /*10亿取模/365*24*60

         * 24*60

         */

         double year2 = NumberOfMintues%(365*24*60)/(24*60);

         System.out.println("the b is " + b +"and day is" + year2);

       

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值