
Java
Hollen0318
Zs.Forever
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Java面向对象静态方法&数组列表参数应用"以购物订单实验为例"(进阶)
Lab: Write classes to model a shopping list.Make an Item class that represents a grocery item’s name and price, such as tissues for $3.Also implement an ItemOrder class that represents a shopper’s d...原创 2019-12-04 10:00:00 · 760 阅读 · 0 评论 -
Java面向对象静态方法及域值控制&域值四则运算"以计算器实验为例"(初级)
*Create a class named Calculator.A calculator has a method to add digits to a running total.The user can also press operator keys such as + or * and then enter digits of a secondnumber.When the us...原创 2019-11-14 11:34:00 · 423 阅读 · 0 评论 -
Java面向对象静态方法及域值控制&日周时分进制方法"以时钟对象实验为例"
Suppose you are given a class named ClockTime with the following contents:假设你有一个包含下列内容名为“时钟时间”的组:Write an instance method advance that will be placed inside the ClockTime class. The method accepts ...原创 2019-11-12 09:51:17 · 309 阅读 · 0 评论 -
Java随机数应用&交互输入比较"以乘法训练实验为例"
Q21.This program helps you practice multiplicationby asking you random multiplication questionswith numbers ranging from 1 to 30and counting how many you solve correctly.14 * 8 = 112Correct!5 * ...原创 2019-11-05 15:10:23 · 254 阅读 · 0 评论 -
Java参数应用&for循环作图“以漩涡图形实验为例”
Q21. 写一条利用for循环程序画出下面的图形。窗口大小为:170 x 170 px“spiral” 从 (0,10),向右 160,向下 150,向左 150, 向上140…import java.awt.*;//调取图形包public class Q28 {//这个实验看上去很复杂,其实是很入门的算法 public static void main(String[] args)...原创 2019-11-05 15:00:18 · 461 阅读 · 0 评论 -
Java字符串参数应用&计词数避免超出数组范围“以计字符串词数实验为例”
Q17. Write a method named wordCount that accepts a String asits parameter and returns the number of words in that string. Wordsare separated by spaces.wordCount(“the quick brown fox”) returns 4Q1...原创 2019-11-02 11:33:37 · 297 阅读 · 0 评论 -
Java字符串参数介数组应用&忽略空格字符串相等判断"以字符串相同实验为例"
Q16. Write a method named areAnagrams that accepts two Strings as parameters and returns whether those strings contain the same letters (in any order).areAnagrams(“bear”, “bare”) returns trueareA...原创 2019-11-02 10:26:53 · 839 阅读 · 0 评论 -
Java数组参数应用&输出数组递增数列"以输出最长数组递增数列实验为例"
Q14.Write a method called longestSortedSequence that accepts anarray of integers as a parameter and that returns the length ofthe longest sorted (nondecreasing) sequence of integers in the arrayQ1...原创 2019-11-02 09:31:52 · 750 阅读 · 0 评论 -
Java数组参数应用&合并数组"以合并数组实验为例"
import java.util.*;import java.util.Scanner;public class Q13 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner console = new Scanner (System.in); /*System....原创 2019-10-31 11:42:01 · 251 阅读 · 0 评论 -
Java数组参数应用&数组相等判断"以样本数组相等判断为例"
Q12. Write a method named equals that accepts two arraysof integers as parameters and returns true if they contain exactlythe same elements in the same order, and false otherwise. Note that thearra...原创 2019-10-31 11:22:14 · 248 阅读 · 1 评论 -
Java数组参数应用&数组间数值覆盖"以数组间数值覆盖实验为例"
Q11. Write a method named copyRange that takes as parameters two arrays a1 and a2, two starting indexes i1 and i2, and a length l,and copies the first l elements of a1 starting at index i1 into array...原创 2019-10-31 10:25:40 · 564 阅读 · 0 评论 -
Java数组参数应用&数组偶数识别"以数组偶数比实验为例"
Q10. Write a method named percentEven thataccepts an array of integers as a parameter and returnsthe percentage of even numbers in the array as a real number. For example, if avariable named nums...原创 2019-10-30 08:47:44 · 298 阅读 · 0 评论 -
Java数组参数应用&数组间差"以最小数组间差实验为例"
Q9. Write a method named minGap that acceptsan integer array as a parameter and returnsthe minimum ‘gap’ between adjacent values inthe array. The gap between two adjacent valuesin a arra...原创 2019-10-30 08:19:32 · 296 阅读 · 0 评论 -
Java逐数读取文件并处理打印"以温度读数实验为例"
import java.io.*; import java.util.Scanner;public class Q12 { public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub Scanner input = new ...原创 2019-10-27 09:51:50 · 364 阅读 · 0 评论 -
Java筛除字符方法&替换字符"以html源文件实验为例"
import java.io.*; import java.util.Scanner;public class Q11 { public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub Scanner input = new...原创 2019-10-27 09:36:02 · 313 阅读 · 0 评论 -
Java读取文档分类赋权值&末行缺失处理"以分类赋权实验为例"
import java.io.*; import java.util.Scanner;public class Q10 { public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub Scanner input = new...原创 2019-10-26 10:01:49 · 657 阅读 · 0 评论 -
Java读取文件并逐行打印众名&末行字符串保留方法"以寻找众名实验为例"
import java.io.*; import java.util.Scanner;public class Q9 { public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub Scanner input = new ...原创 2019-10-25 21:00:52 · 336 阅读 · 0 评论 -
Java避免末尾字符串换行&读取文件段行词拆分"以打印重复字符串实验为例"
import java.io.*; import java.util.Scanner;public class Q8 { public static void main(String[] args) throws FileNotFoundException {//避免寻找文件失效 // TODO Auto-generated method stub Scanner in...原创 2019-10-25 18:28:29 · 316 阅读 · 0 评论 -
Java百分比计算以及显示方法“以掷硬币实验为例”
import java.io.*; import java.util.Scanner;import java.text.DecimalFormat;import java.text.NumberFormat;public class Q7 { public static void main(String[] args) throws FileNotFoundException {...原创 2019-10-25 15:02:47 · 405 阅读 · 0 评论