標籤:第二次作業對於以下兩個程式1、找出fault2、如果可能的話,找出一個測試案例不執行fault3、如果可能的話,找出一個測試案例執行fault,但是不產生error4、如果可能的話,找出一個測試案例產生error,但是不會導致failurepublic intfindLast(int[] x, inty) {//Effects: If x==null throw NullPointerException// else return the index of the last
標籤:1)瞭解錯誤類型:Fault : A static defect in the software.【一個靜態在軟體中產生的錯誤。】 Failure : External, incorrect behavior with respect to the requirements or other description of the expected behavior.【外部的表現,不正確的行為,相對於預期的行為的要求或其他描述。】 Error : An
標籤:public int findLast (int[] x, int y) { //Effects: If x==null throw NullPointerException // else return the index of the last element // in x that equals y. // If no such element exists, return -1 for (int i=x.length-1; i > 0; i--) { if (x[i] ==
標籤:程式思想:1.定義數組儲存隨機數,2.while 迴圈30次3.第一個判斷奇偶,奇數則為整數運算,偶數為假分數運算,4.然後為運算項,然後將隨機數除以四,分別為加減乘除。5.進行判斷是否重複,不重複則儲存並輸出。代碼:#include<iostream>using namespace std;#include<time.h>void main(){ int n
標籤:1設計思路定義變數:int i,b,num1,num2,num3;double m,n;實用迴圈實現30次出題:隨機產生參與運算的數以及運算子;用switch實現四則運算出題並輸出;原始碼:package 隨機;public class Suiji { public static void main(String[] args) { int