求 JAVA 试题 填空题答案。

求 JAVA 试题 填空题答案。,第1张

1编辑源程序,编译为字节码,解释执行字节码(编辑、编译、执行)

2源程序的文件名,javaappletApplet,MyApplet

3javac MyJavaApplicationjava,java MyJavaApplication

42 2

5false

633 66 99

7private static double additoryFee = 01;

8定义,调用

9String,StringBuffer

10Label gxdd = new Label("广西广播电视大学");

Button gb = new Button("关闭");

11class,interface

12套接字,IP地址,接口

130 31

14类名

15父类

仅供参考,未测试

Question1

package comkiddatmtest;

import javautilScanner;

public class Question1 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(Systemin);

        Systemoutprint("输入基本运费,货重,距离(均为整数,用,分割):");

        String[] ss = scannernext()split(",");

        int p = IntegerparseInt(ss[0]);

        int w = IntegerparseInt(ss[1]);

        int s = IntegerparseInt(ss[2]);

        double d ;

        if(s < 250){

            d=0 ;

        }else if(s < 500){

            d=002;

        }else if(s < 1000){

            d=005;

        }else if(s < 2000){

            d=008 ;

        }else{

            d=01;

        }

        

        Systemoutprintln("总运费f="+(pws(1-d)));

    }

}

Question2

package comkiddatmtest;

import javautilScanner;

public class Question2 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(Systemin);

        Systemoutprint("请输入x:");

        int x = scannernextInt();

        int y ;

        if(x<0){

            y=-1;

        }else if (x >0){

            y=1;

        }else{

            y=0;

        }

        Systemoutprintln("y="+y);

    }

}

Question3

package comkiddatmtest;

import javautilScanner;

public class Question3 {

    public static void main(String[] args) {

        int index = 0;

        Scanner scanner = new Scanner(Systemin);

        boolean end = false;

        while (!end) {

            Systemoutprint("请输入卡号,密码:");

            scannernext();

            index++;

            Systemoutprint("账号或密码错误次数" + index + ",");

            if (index >= 3) {

                Systemoutprintln("吞卡");

                end = true;

            } else {

                Systemoutprintln("请重新输入");

            }

        }

    }

}

Question4

package comkiddatmtest;

import javautilScanner;

public class Question4 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(Systemin);

        Systemoutprint("输入一个整数:");

        String string = scannernext();

        for (int i = 0, k = stringlength(); i < k; i++) {

            Systemoutprintln(stringcharAt(i));

        }

    }

}

Question5

package comkiddatmtest;

import javautilRandom;

import javautilScanner;

public class Question5 {

    public static void main(String[] args) {

        int i = new Random()nextInt(40) + 60;

        boolean end = false;

        int n;

        int index = 1;

        Scanner scanner = new Scanner(Systemin);

        while (!end) {

            Systemoutprint("请输入你猜的结果:");

            n = scannernextInt();

            if (n > i) {

                Systemoutprintln("大了");

                index++;

            } else if (n < i) {

                Systemoutprintln("小了");

                index++;

            } else {

                end = true;

            }

        }

        Systemoutprint("猜对了,一共猜了" + index + "次,你是");

        if (index < 5) {

            Systemoutprint("天才");

        } else {

            Systemoutprint("笨蛋");

        }

    }

}

Question6

package comkiddatmtest;

import javautilScanner;

public class Question6 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(Systemin);

        Systemoutprint("请输入要打印的元素个数:");

        int n = scannernextInt();

        if (n < 1) {

            Systemoutprintln("无输出结果");

        }

        if (n >= 1) {

            Systemoutprint("1");

        }

        if (n >= 2) {

            Systemoutprint(",2");

        }

        if (n > 2) {

            int f1 = 1;

            int f2 = 2;

            int sum;

            for (int i = 3; i <= n; i++) {

                sum = f1 + f2;

                Systemoutprint("," + (f1 + f2));

                f1 = f2;

                f2 = sum;

            }

        }

    }

}

java

解释

不执行

高级

main

声明

String

顺序、选择、循环

false

没有

90

true

静态

局部变量

IntegerparseInt()

5

break、continue、return

randomnextInt(100)

定义一个数组的引用、对数组进行初使化、数组越界

封装、继承、多态

path、classpath

可以

10

0

continue

boolean

randnextInt(5)

double

没有

顺序、选择、循环

Systemoutprintln(m+1)

x定义了但没有赋值、语法

单行、多行

10

数组的引用

float

y=IntegerparseInt(x)

一个

public

public static int a()

以上就是关于求 JAVA 试题 填空题答案。全部的内容,包括:求 JAVA 试题 填空题答案。、java编程的作业试题大家帮我解答一下,谢谢了,一共两个题,在下面,请大家一定要帮我解答一下,我不会做、计算机java程序设计与算法试题求解等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/9278348.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-26
下一篇2023-04-26

发表评论

登录后才能评论

评论列表(0条)

    保存