CMIS 141
Graded Discussion: Bugs can be frustrating
Post a piece of Java code that you wrote, related to this week's readings, that has bug in it.
Respond to at least one other student's buggy code with possible solutions. Be sure to explain in detail the issues and how they were fixed.
EXAMPLE: The code below has two bugs in it, I kept it short so you are able to figure it out
/* * File: BuggedCode * Author: Daren Dean * Date: October 27th, 2016 @ 1600 * Purpose: For CMIS 141 Week 2 Discussion */
// Import statements import java.util.Scanner;
public class BuggedCode{ public static void main (String[] args){
// Display a Welcome note System.out.println("Welcome to Week 2 discussion, can you find the bug?") // create a scanner so we can read the command-line input Scanner scanner = new Scanner(System.in);
// prompt the user to enter their age System.out.print Enter your Age: // get their input as a int int age = scanner.nextInt();
// prompt the user for their weight System.out.print("Enter your weight: "); // get the weight as an int int weight = scanner.nextInt();
System.out.println("************Thank you for your participation**************"); // Output Values System.out.println("Your Age is:" + age); System.out.println("Your Weight is:" + weight); System.out.println("**************************************************************"); System.out.println("\n");
}// end method in main
}// end class BuggedCode