Professional Documents
Culture Documents
Registration No FA19-BSE-079
Class BSE-6B
Assignment 2nd
Teacher Sir Mazhar Bukhari
Subject Software Testing
Dated April 24th, 2022
1
CODE
import java.util.Scanner;
/**
* @author fa19-bse-079
*/
2
char ch = stdin.next().charAt(0);
+ str + "\".");
str = stdin.next();
/**
* @bugs There are TWO minor errors. Can you find and fix them?
*/
int count = 0;
if (s != null) {
3
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == c) {
count++;
return count;
/**
* @bugs There are TWO minor errors. Can you find and fix them?
*/
int j=1;
4
swap[i] = swap[swap.length-j];
swap[swap.length-j] = cTmp;
j++;
GAME CODE
package debuggingassignment;
import java.util.Scanner;
/**
* @author fa19-bse-079
*/
5
Scanner stdin = new Scanner(System.in);
char ch = stdin.next().charAt(0);
package debuggingassignment;
import java.util.Random;
import java.util.Scanner;
/**
* @author fa19-bse-079
*/
6
int computerPoints = 0;
int humanPoints = 0;
System.out.println("2. Each round you will guess the number rolled on a six-sided die.");
System.out.println("4. Whoever has the most points after five rounds wins.");
System.out.println("-------");
rolled = ranGen.nextInt(sides+1);
rightGuess = false;
int numGuesses = 0;
do {
userguess = userInput.nextInt();
7
if (rolled == userguess) {
System.out.println(" Correct!");
rightGuess=true;
} else {
numGuesses++;
if (rightGuess) {
humanPoints++;
} else {
computerPoints++;
System.out.println("Scores:");
System.out.println("");
} else {
8
System.out.println("Thanks for playing the Guess Game!");
Screenshots
9
10
11