范文无忧网面试笔试笔试回答

计算机编程java语言题目

02月22日 编辑 fanwen51.com

[编程笔试题目]一、单项选择题 下列各题备选项中,只有一项是正确的,请将所选答案序号填入题目的括号内。(共15分,每小题1分) 1、储蓄机构的设置要求熟悉储蓄业务的工作人员不少于(C)。 A、二人 B...+阅读

********************************** 新建类LuggageFee.java,代码如下: ******************************************************************** import java.util.Scanner; public class LuggageFee { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { System.out.println("Please input the luggage weight: "); String in = sc.nextLine(); if (in.matches("[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*|[1-9]\\d*")) { System.out.println("The " + in.trim() + " luggage fee is: " + getLuggageFee(Double.valueOf(in))); } else { System.out.println("Input error, please try again!"); } } } public static double getLuggageFee(double weight) { if (weight < 20) { return 0; } else if (weight < 40) { return (weight - 20) * 0.015; } else { return (weight - 20) * 0.015 + (weight - 40) * 2 * 0.015; } } } ******************************************************************** 运行结果如下: ******************************************************************** Please input the luggage weight: -3 Input error, please try again! Please input the luggage weight: 15 The 15 luggage fee is: 0.0 Please input the luggage weight: 25 The 25 luggage fee is: 0.075 Please input the luggage weight: 100 The 100 luggage fee is: 3.0 Please input the luggage weight:

延伸阅读:

编程员面试题目①链表反转 单向链表的反转是一个经常被问到的一个面试题,也是一个非常基础的问题。比如一个链表是这样的:1-2-3-4-5通过反转后成为5-4-3-2-1。 最容易想到的方法遍历一遍链表...

面试计算机编程的自我介绍我是一个来自于广东汕头市某个农村的孩子,我叫XX,今年毕业于XX大学,今年20岁,今天面试的是贵公司的XX职位。 以前对所有事物都充满好奇.所以就带着好奇来到了一个不知名的学校.来开始...

威盛编程面试题目关于编程类在面试题目有哪些呢?下面我们来了解一下威盛编程面试主要考察在题目。 1.三组程序,找出你认为的错误。 (1)a.c long temp[255]; b.c extern *temp; (2)a.c long tem...

java程序编程/* *这种方法只能解决绳子的长度为整数有问题 *而且只能提供一个可用解 *我经验不也深,有问题请多多指点 */ public class TestLong { public static void main(String[] arg...

计算机二级考试c语言题目这个主要考察变量的作用域 对于int a=1这句中的a作用域是最大的,是整个.c文件,首先要明白,当这个a的作用域中的其他地方出现同名变量定义时,这个作用域比较大的变量失效,也就是说...

javascript编程题目function getNum(){var i =1; var s = 1; while(true){ i++; var str = i.toString(); var index = str.indexOf("1"); while(index != -1){ s++; str=str.substring(index+1)...

java经典编程题目import java.util.*; import javax.swing.JOptionPane; class abc { public static void main(String args[]) { for(int i=10;i>0;i++) { max(); } } public static void y...

有个计算机C语言编程考试题速求能人 !#include//因为下面要用到printf和scanf函数 #include//因为下面要用到strlen函数(计算一个char数组的长度) #include//因为下面要用到pow函数(计算一个数的N次方) #include//因...

请教大家一个C语言面试的编程题目这是一道老题目了,代码如下,望采纳: #include #include int findNUM(void) { int cnt = 0; int N = 0; //EDCBA int Nswitch = 0; //ABCDE for(cnt = 10000 * 4; cnt { Nswitch...

推荐阅读
图文推荐
栏目列表